We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3befe80 commit 2585b81Copy full SHA for 2585b81
lib/internal/streams/pipeline.js
@@ -219,6 +219,11 @@ function pipeline(...streams) {
219
PassThrough = require('_stream_passthrough');
220
}
221
222
+ // If the last argument to pipeline is not a stream
223
+ // we must create a proxy stream so that pipeline(...)
224
+ // always returns a stream which can be further
225
+ // composed through `.pipe(stream)`.
226
+
227
const pt = new PassThrough();
228
if (isPromise(ret)) {
229
ret
@@ -253,6 +258,9 @@ function pipeline(...streams) {
253
258
254
259
255
260
261
+ // TODO(ronag): Consider returning a Duplex proxy if the first argument
262
+ // is a writable. Would improve composability.
263
+ // See, https://github.com/nodejs/node/issues/32020
256
264
return ret;
257
265
266
0 commit comments