Node 'readline' module does not have an 'end' event - how can I do something when there are no more lines?

StackOverflow https://stackoverflow.com/questions/22915794

  •  29-06-2023
  •  | 
  •  

Question

Reading the official docs for the readline module, there is no end event like other streams. Trying

reader.on('end', cb);

Doesn't work.

How can I run a callback once there are no more lines to be read?

Was it helpful?

Solution

Nevermind, it's close.

reader.on('close', cb);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top