Node.js · Junior · Question 56 of 75
How do you create a folder together with any missing parent folders?
- 1
await mkdirAll("a/b/c") - 2
await mkdir("a/b/c")always creates parents - ✓Correct answer:
await mkdir("a/b/c", { recursive: true })
Explanation
With recursive: true, mkdir also does not fail if the folder already exists. rm(path, { recursive: true, force: true }) is the matching way to delete a tree.