javascript 节点“readline”模块没有“end”事件 - 当没有更多行时我该如何做?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22915794/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 00:01:46 来源:igfitidea点击:
Node 'readline' module does not have an 'end' event - how can I do something when there are no more lines?
提问by mikemaccana
Reading the official docs for the readline module, there is no endevent like other streams.
Trying
阅读readline 模块的官方文档,没有end像其他流那样的事件。试
reader.on('end', cb);
Doesn't work.
不起作用。
How can I run a callback once there are no more lines to be read?
一旦没有要读取的行,我该如何运行回调?
回答by mikemaccana
Nevermind, it's close.
没关系,是close。
reader.on('close', cb);

