aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZiJian Liu <Lxxyxzj@gmail.com>2020-12-11 22:11:14 +0800
committerNode.js GitHub Bot <github-bot@iojs.org>2020-12-15 13:40:40 +0000
commit6837a6de9760fcff8ad106009538b0c5cebd1967 (patch)
tree40676d3457b933a89f9ae9b818e7fa5645544636 /lib
parent45dbcbef90d9002efbe3c67202d0338eb243b2a1 (diff)
downloadios-node-v8-6837a6de9760fcff8ad106009538b0c5cebd1967.tar.gz
ios-node-v8-6837a6de9760fcff8ad106009538b0c5cebd1967.tar.bz2
ios-node-v8-6837a6de9760fcff8ad106009538b0c5cebd1967.zip
stream: accept iterable as a valid first argument
Fixes: https://github.com/nodejs/node/issues/36437 PR-URL: https://github.com/nodejs/node/pull/36479 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/internal/streams/pipeline.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/internal/streams/pipeline.js b/lib/internal/streams/pipeline.js
index b23f05ca1f..89561433c8 100644
--- a/lib/internal/streams/pipeline.js
+++ b/lib/internal/streams/pipeline.js
@@ -144,7 +144,10 @@ async function pump(iterable, writable, finish) {
function pipeline(...streams) {
const callback = once(popCallback(streams));
- if (ArrayIsArray(streams[0])) streams = streams[0];
+ // stream.pipeline(streams, callback)
+ if (ArrayIsArray(streams[0]) && streams.length === 1) {
+ streams = streams[0];
+ }
if (streams.length < 2) {
throw new ERR_MISSING_ARGS('streams');