N
N
Nicholas2016-05-13 16:54:20
Node.js
Nicholas, 2016-05-13 16:54:20

How to save a file to a non-existent folder:?

How to save a file with deep file attachment?

var url ='./helloworld/bla/bla/bla.txt' ;

               fs.writeFile(url, 'Hello World!', function (err) {
                    if (err) return console.log(err);
                        console.log('Hello World > helloworld.txt');
                });

There are no bla/bla folders and I get an error! how to make all folders automatically created? is there a ready-made version?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nicholas, 2016-05-13
@ACCNCC

https://www.npmjs.com/package/file-save

D
Dmitry Belyaev, 2016-05-13
@bingo347

https://www.npmjs.com/package/mkdirp

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question