MCPcopy Index your code
hub / github.com/nodejs/node / pipeline

Function pipeline

lib/stream/promises.js:19–39  ·  view source on GitHub ↗
(...streams)

Source from the content-addressed store, hash-verified

17require('stream');
18
19function pipeline(...streams) {
20 return new Promise((resolve, reject) => {
21 let signal;
22 let end;
23 const lastArg = streams[streams.length - 1];
24 if (lastArg && typeof lastArg === 'object' &&
25 !isNodeStream(lastArg) && !isIterable(lastArg) && !isWebStream(lastArg)) {
26 const options = ArrayPrototypePop(streams);
27 signal = options.signal;
28 end = options.end;
29 }
30
31 pl(streams, (err, value) => {
32 if (err) {
33 reject(err);
34 } else {
35 resolve(value);
36 }
37 }, { signal, end });
38 });
39}
40
41module.exports = {
42 finished,

Callers 2

license2rtf.mjsFile · 0.90

Calls 6

isNodeStreamFunction · 0.85
isWebStreamFunction · 0.85
plFunction · 0.85
isIterableFunction · 0.50
rejectFunction · 0.50
resolveFunction · 0.50

Tested by

no test coverage detected