MCPcopy
hub / github.com/nodejs/undici / stream

Function stream

lib/api/api-stream.js:248–268  ·  view source on GitHub ↗
(opts, factory, callback)

Source from the content-addressed store, hash-verified

246}
247
248function stream (opts, factory, callback) {
249 if (callback === undefined) {
250 return new Promise((resolve, reject) => {
251 stream.call(this, opts, factory, (err, data) => {
252 return err ? reject(err) : resolve(data)
253 })
254 })
255 }
256
257 try {
258 const handler = new StreamHandler(opts, factory, callback)
259
260 this.dispatch(opts, handler)
261 } catch (err) {
262 if (typeof callback !== 'function') {
263 throw err
264 }
265 const opaque = opts?.opaque
266 queueMicrotask(() => callback(err, { opaque }))
267 }
268}
269
270module.exports = stream

Callers 4

redirect-stream.jsFile · 0.85
issue-2349.jsFile · 0.85
api.test-d.tsFile · 0.85
agent.jsFile · 0.85

Calls 3

rejectFunction · 0.85
resolveFunction · 0.85
dispatchMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…