Node stream.pipeline 是否也提供反压保护?

Does Node stream.pipeline also provides back-pressuring prevention?

这个问题的答案或许是一个字。文档 here is kind of confusing: in the beginning it introduces the stream.pipeline() method as even a more preferable version of .pipe method, but later on it focuses solely on the .pipe method as a method that provides back-pressuring prevention mechanism. The Node official doc 也明确提到 .pipe 具有反压预防机制,但没有提到 pipeline 方法。那么:管道(作为 .pipe 的改进版本)是否会进行相同的调节以防止管道中出现反压?但愿如此。干杯!

是的,pipeline() 处理背压。它基本上 .pipe() 有很多更好的错误处理和更灵活的编程接口。