Closed
Description
While authoring a parser, I came across what you would normally get in organic search and found lots of it a little dangerous. Namely the use of big module APIs from npm
don't occur to make the biggest sense here, since readline
has a lot of good functionality built-in. Namely consuming file through readline
's interface as steam.
In order to promote use of this, I'd suggest to add an example usage to the docs, which I derived from this stackoverflow link.
This case seemed really common to me, which is why I authored the below PR.
const readline = require('readline');
const fs = require('fs');
const rl = readline.createInterface({
input: fs.createReadStream('sample.txt')
});
rl.on('line', function (line) {
console.log('Line from file:', line);
});
PR: #4609