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

Function Readable

lib/internal/streams/readable.js:327–369  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

325};
326
327function Readable(options) {
328 if (!(this instanceof Readable))
329 return new Readable(options);
330
331 this._events ??= {
332 close: undefined,
333 error: undefined,
334 data: undefined,
335 end: undefined,
336 readable: undefined,
337 // Skip uncommon events...
338 // pause: undefined,
339 // resume: undefined,
340 // pipe: undefined,
341 // unpipe: undefined,
342 // [destroyImpl.kConstruct]: undefined,
343 // [destroyImpl.kDestroy]: undefined,
344 };
345
346 this._readableState = new ReadableState(options, this, false);
347
348 if (options) {
349 if (typeof options.read === 'function')
350 this._read = options.read;
351
352 if (typeof options.destroy === 'function')
353 this._destroy = options.destroy;
354
355 if (typeof options.construct === 'function')
356 this._construct = options.construct;
357
358 if (options.signal)
359 addAbortSignal(options.signal, this);
360 }
361
362 Stream.call(this, options);
363
364 if (this._construct != null) {
365 destroyImpl.construct(this, () => {
366 this._readableState[kOnConstructed](this);
367 });
368 }
369}
370
371Readable.prototype.destroy = destroyImpl.destroy;
372Readable.prototype._undestroy = destroyImpl.undestroy;

Callers 1

getLoremIpsumStreamFunction · 0.50

Calls 2

callMethod · 0.45
constructMethod · 0.45

Tested by

no test coverage detected