fs.writefile create folder code example
Example 1: fs writefile node
const fs = require('fs')
const content = 'Some content!'
fs.writeFile('/Users/joe/test.txt', content, err => {
if (err) {
console.error(err)
return
}
//file written successfully
})
Example 2: how to create a folder using fs in node js
//Include fs module
const fs = require('fs');
const dir = './dir'
fs.mkdir(dir);