(options)
| 325 | }; |
| 326 | |
| 327 | function 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 | |
| 371 | Readable.prototype.destroy = destroyImpl.destroy; |
| 372 | Readable.prototype._undestroy = destroyImpl.undestroy; |
no test coverage detected