Skip to content

Instantly share code, notes, and snippets.

@ryanhanwu
Created Nov 16, 2018
Embed
What would you like to do?
NodeJs Log
fs.appendFile('message.txt', 'data to append', function (err) {
if (err) throw err;
console.log('Saved!');
});
var readline = require('readline');
var fs = require('fs');
var myInterface = readline.createInterface({
input: fs.createReadStream('demofile1.html')
});
var lineno = 0;
myInterface.on('line', function (line) {
lineno++;
console.log('Line number ' + lineno + ': ' + line);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment