| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 728f512 commit d8b5b94
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -144,7 +144,10 @@ async function pump(iterable, writable, finish) { | |||
| 144 | 144 | function pipeline(...streams) { | |
| 145 | 145 | const callback = once(popCallback(streams)); | |
| 146 | 146 | ||
| 147 | - if (ArrayIsArray(streams[0])) streams = streams[0]; | ||
| 147 | + // stream.pipeline(streams, callback) | ||
| 148 | + if (ArrayIsArray(streams[0]) && streams.length === 1) { | ||
| 149 | + streams = streams[0]; | ||
| 150 | + } | ||
| 148 | 151 | ||
| 149 | 152 | if (streams.length < 2) { | |
| 150 | 153 | throw new ERR_MISSING_ARGS('streams'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1285,3 +1285,19 @@ const net = require('net'); | |||
| 1285 | 1285 | }); | |
| 1286 | 1286 | const pipelined = addAbortSignal(ac.signal, pipeline([r, w], cb)); | |
| 1287 | 1287 | } | |
| 1288 | + | ||
| 1289 | + { | ||
| 1290 | + pipeline([1, 2, 3], PassThrough({ objectMode: true }), | ||
| 1291 | + common.mustSucceed(() => {})); | ||
| 1292 | + | ||
| 1293 | + let res = ''; | ||
| 1294 | + const w = new Writable({ | ||
| 1295 | + write(chunk, encoding, callback) { | ||
| 1296 | + res += chunk; | ||
| 1297 | + callback(); | ||
| 1298 | + }, | ||
| 1299 | + }); | ||
| 1300 | + pipeline(['1', '2', '3'], w, common.mustSucceed(() => { | ||
| 1301 | + assert.strictEqual(res, '123'); | ||
| 1302 | + })); | ||
| 1303 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments