If I use fs.writeFile, I get:
Error: ENOENT, No such file or directory
I think that since the directories in which the file is located does not exist.
Should I use fs.mkdir first or something else?
Thanks.
Node.js lacks a recursive directory creator in the main API.
Someone has yet to do something equivalent to Perl File :: Path , but here is 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