mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
stream: add comments to pipeline implementation
Fixes: https://github.com/nodejs/node/issues/32039 PR-URL: https://github.com/nodejs/node/pull/32042 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
f69de13bfe
commit
960be159ac
1 file changed
+8
@@ -202,6 +202,11 @@ function pipeline(...streams) {
|
||||
PassThrough = require('_stream_passthrough');
|
||||
}
|
||||
|
||||
// If the last argument to pipeline is not a stream
|
||||
// we must create a proxy stream so that pipeline(...)
|
||||
// always returns a stream which can be further
|
||||
// composed through `.pipe(stream)`.
|
||||
|
||||
const pt = new PassThrough();
|
||||
if (isPromise(ret)) {
|
||||
ret
|
||||
@@ -236,6 +241,9 @@ function pipeline(...streams) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(ronag): Consider returning a Duplex proxy if the first argument
|
||||
// is a writable. Would improve composability.
|
||||
// See, https://github.com/nodejs/node/issues/32020
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user