If I use fs.writeFile I get:
Error: ENOENT, No such file or directory
I think that’s because the directories that houses the file doesn’t exist.
Am I supposed to use fs.mkdir first or is there something else?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Node.js lacks a recursive directory creator in the core API.
Someone is yet to make something equivalent to Perl’s File::Path, but here’s at least a recursive creator in Node:
https://github.com/isaacs/npm/blob/master/lib/utils/mkdir-p.js
Edit:
This is probably easier to use: https://github.com/bpedro/node-fs