- writeFile
Write file
examples/fs/write_file.js
const fs = require('fs'); fs.writeFile('data.txt', 'first line', (err) => { if (err) { console.log(err); } else { console.log('Success'); } });
const fs = require('fs'); fs.writeFile('data.txt', 'first line', (err) => { if (err) { console.log(err); } else { console.log('Success'); } });