Answer the question
In order to leave comments, you need to log in
nodejs. How to create a file based on the folder structure?
Let's say you need to create the file "/tmp/storage/28/08/2808c0dd765c2f0f486e0941d9da3544". Is it possible, using the built-in Nodejs tools, to create the entire folder structure if they don't exist? Or will you have to parse the regular string and call fs.exists and fs.mkdir for each folder?
Answer the question
In order to leave comments, you need to log in
Yes, you need to create each directory separately. if it's lazy then kind people wrote a module: https://github.com/substack/node-mkdirp
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question