节点'readline'模块没有'结束'事件 - 如果没有更多行,我该怎么办?

时间:2022-07-18 21:01:58

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

阅读readline模块的官方文档,没有像其他流一样的结束事件。试

reader.on('end', cb);

Doesn't work.

不起作用。

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

一旦没有更多行要读取,我该如何运行回调?

1 个解决方案

#1


46  

Nevermind, it's close.

没关系,它很接近。

reader.on('close', cb);

#1


46  

Nevermind, it's close.

没关系,它很接近。

reader.on('close', cb);