diff --git a/lib/internal/streams/pipeline.js b/lib/internal/streams/pipeline.js index ba69c673cc6b20..97f56032b1b11c 100644 --- a/lib/internal/streams/pipeline.js +++ b/lib/internal/streams/pipeline.js @@ -84,9 +84,7 @@ async function* fromReadable(val) { yield* Readable.prototype[SymbolAsyncIterator].call(val); } -async function pump(iterable, writable, finish, opts) { - const end = opts?.end !== false; - +async function pump(iterable, writable, finish, { end }) { let error; let onresolve = null; @@ -208,11 +206,10 @@ function pipelineImpl(streams, callback, opts) { const writing = i > 0; const end = reading || opts?.end !== false; - if (isNodeStream(stream) && end) { - destroys.push(destroyer(stream, reading, writing)); - } - if (isNodeStream(stream)) { + if (end) { + destroys.push(destroyer(stream, reading, writing)); + } eos(stream, { readable: reading, writable: writing }, (err) => { if (err && err.name !== 'AbortError' && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { finish(err); @@ -310,9 +307,7 @@ function pipelineImpl(streams, callback, opts) { return ret; } -function pipe(src, dst, finish, opts) { - const end = opts?.end !== false; - +function pipe(src, dst, finish, { end }) { src.pipe(dst, { end }) if (end) {