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
  •  | 
  •  

문제

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?

도움이 되었습니까?

해결책

Nevermind, it's close.

reader.on('close', cb);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top