Answers for "create directory when writing to file in nodejs"

0

create directory when writing to file in nodejs

fs.mkdir now accepts a { recursive: true } option like so:

// Creates /tmp/a/apple, regardless of whether `/tmp` and /tmp/a exist.
fs.mkdir('/tmp/a/apple', { recursive: true }, (err) => {
  if (err) throw err;
});
Posted by: Guest on May-13-2021

Code answers related to "create directory when writing to file in nodejs"

Code answers related to "Javascript"

Browse Popular Code Answers by Language