Node.js Write File With Directories?
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 firs
Solution 1:
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
Post a Comment for "Node.js Write File With Directories?"