Node create textfile code example
Example 1: data not write in file node js
const fs = require('fs');
fs.readFile('file.txt', 'utf-8', (err, data) => {
if(err) {
throw err;
}
console.log(data);
});
Example 2: writefile in node js
fs.writeFile('2pac.txt', 'Some other lyric', 'ascii', callback);