开发者

Decoupling a Stream.pipe

开发者 https://www.devze.com 2023-04-10 20:42 出处:网络
Node.js has an easy way to coupl开发者_C百科e two datastreams: readableStream.pipe(writeableStream);

Node.js has an easy way to coupl开发者_C百科e two datastreams:

readableStream.pipe(writeableStream);

... and it's great because it handles buffering and such for you behind the scenes.

What's the best way to decouple those two streams without closing either of them?


You can find the source code for Stream.pipe in the git repository, and I do not see a clear way to decouple it other than one of the streams ending, or closing.

Pipe is nothing more than once a stream receives data, the other one is written to, so it would be rather simple to write your own implementation, with your own needs.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号