var rd = readline.createInterface({
input: fs.createReadStream(file),
output: process.stdout,
terminal: false
});
rd.on('line', function(line) {
And is any way how to make "on" working synchronous. Code inside "on" loop need to be done before executing loop again. Is any way how to do that?
Generally, the on function registers an event handler for a specific event.
The readline::line event serves for this purpose:
Emitted whenever the input stream receives a \n, usually received when the user hits enter, or return. This is a good hook to listen for user input.
— NodeJS documentation
By the way, which keywords did you use for your search? I used nodejs readline.createInterface and the first result was this NodeJS documentation page!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With