Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mujuni88/0c499aabd3b76df40c1d29a0bca56888 to your computer and use it in GitHub Desktop.
Save mujuni88/0c499aabd3b76df40c1d29a0bca56888 to your computer and use it in GitHub Desktop.
var fs = require('fs');
var readline = require('readline');
var Stream = require('stream');
function readFileLineByLine(inputFile, outputFile) {
var instream = fs.createReadStream(inputFile);
var outstream = new Stream();
outstream.readable = true;
outstream.writable = true;
var rl = readline.createInterface({
input: instream,
output: outstream,
terminal: false
});
rl.on('line', function (line) {
fs.appendFileSync(outputFile, line + '\n');
});
};
@mujuni88
Copy link
Author

mujuni88 commented Sep 2, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment