1

我正在尝试在 Node.js 中实现可写流。我正在阅读 SubStack 的优秀流手册我想知道当读取流停止写入时(当它调用push(null)时)是否有办法在可写流中查找?可写流的实现是否可以订阅完成事件?

4

1 回答 1

1

No reason why not subscribe to end event. It's in the contract, regardless of who consumes it.

Some of the streams referenced in the handbook you mention do that themselves. For example:

https://github.com/Raynos/duplexer/blob/master/index.js#L36

于 2013-10-11T22:05:10.627 回答