Node: fs common uses
Official Doc: File System API const fs = require('fs'); Append to a file (if file doesnt exist, create it) Useful when need to log to a file. fs.appendFile('message.txt', 'data to append', function (err) { if (err) throw err; console.log('Saved!'); }); Write a file const fs = require('fs'); fs.writeFile("/tmp/test", "Hey there!", function(err) { if(err) { return console.log(err); } console.log("The file was saved!"); }); // Or fs.writeFileSync('/tmp/test-sync', 'Hey there!'); Read a file one line at a time Since Node....