demo_fs_append.js:
var fs = require('fs'); //create a file named mynewfile1.txt: fs.appendFile('mynewfile1.txt', 'Hello content!', function (err) { if (err) throw err; console.log('Saved!'); });
C:\Users\My Name>node demo_fs_append.js
Saved!