Is it possible to use the fs
API to create a directory and all necessary subdirectories like the -p
parameter does when using the mkdir
command?
Use fs.mkdirSync
with the recursive: true
option:
fs.mkdirSync('/tmp/a/apple', { recursive: true });
You can either write your own version or use a module like mkdirp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With