How do I use nodejs to write a file, if the file is in a directory that may or may not exist?
It’s kind of similar to this question:
node.js Write file with directories?
Only I need a solution that creates the file while node-fs only makes directories.
From FileUtils:
Modify the functions to satisfy yours needs! But seriously, use a module instead of writing your own!
createDirectory(): Creates a directory. If any of the previous directories that form the path don’t exist, they are created. Default permissions: 0777.
createNewFile(): Creates a new file. Default permissions: 0666.