MCPcopy Create free account
hub / github.com/nodejs/undici / constructor

Method constructor

lib/api/readable.js:35–79  ·  view source on GitHub ↗

* @param {object} opts * @param {(this: Readable, size: number) => void} opts.resume * @param {() => (void | null)} opts.abort * @param {string} [opts.contentType = ''] * @param {number} [opts.contentLength] * @param {number} [opts.highWaterMark = 64 * 1024]

({
    resume,
    abort,
    contentType = '',
    contentLength,
    highWaterMark = 64 * 1024 // Same as nodejs fs streams.
  })

Source from the content-addressed store, hash-verified

33 * @param {number} [opts.highWaterMark = 64 * 1024]
34 */
35 constructor ({
36 resume,
37 abort,
38 contentType = '',
39 contentLength,
40 highWaterMark = 64 * 1024 // Same as nodejs fs streams.
41 }) {
42 super({
43 autoDestroy: true,
44 read: resume,
45 highWaterMark
46 })
47
48 this._readableState.dataEmitted = false
49
50 this[kAbort] = abort
51
52 /** @type {Consume | null} */
53 this[kConsume] = null
54
55 /** @type {number} */
56 this[kBytesRead] = 0
57
58 /** @type {ReadableStream|null} */
59 this[kBody] = null
60
61 /** @type {boolean} */
62 this[kUsed] = false
63
64 /** @type {string} */
65 this[kContentType] = contentType
66
67 /** @type {number|null} */
68 this[kContentLength] = Number.isFinite(contentLength) ? contentLength : null
69
70 /**
71 * Is stream being consumed through Readable API?
72 * This is an optimization so that we avoid checking
73 * for 'data' and 'readable' listeners in the hot path
74 * inside push().
75 *
76 * @type {boolean}
77 */
78 this[kReading] = false
79 }
80
81 /**
82 * @param {Error|null} err

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected