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

Function stream

deps/undici/undici.js:17903–17921  ·  view source on GitHub ↗
(opts, factory, callback)

Source from the content-addressed store, hash-verified

17901 }
17902 };
17903 function stream(opts, factory, callback) {
17904 if (callback === void 0) {
17905 return new Promise((resolve, reject) => {
17906 stream.call(this, opts, factory, (err, data) => {
17907 return err ? reject(err) : resolve(data);
17908 });
17909 });
17910 }
17911 try {
17912 const handler = new StreamHandler(opts, factory, callback);
17913 this.dispatch(opts, handler);
17914 } catch (err) {
17915 if (typeof callback !== "function") {
17916 throw err;
17917 }
17918 const opaque = opts?.opaque;
17919 queueMicrotask(() => callback(err, { opaque }));
17920 }
17921 }
17922 __name(stream, "stream");
17923 module2.exports = stream;
17924 }

Callers 1

pipelineImplFunction · 0.50

Calls 6

queueMicrotaskFunction · 0.85
dispatchMethod · 0.65
rejectFunction · 0.50
resolveFunction · 0.50
callbackFunction · 0.50
callMethod · 0.45

Tested by

no test coverage detected