Created
November 16, 2018 19:37
-
-
Save ryanhanwu/9171102932af928284d2ab3c7117fed7 to your computer and use it in GitHub Desktop.
NodeJs Log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fs.appendFile('message.txt', 'data to append', function (err) { | |
if (err) throw err; | |
console.log('Saved!'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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