2 * A stream is an abstract interface for working with streaming data in Node.js.
3 * The `stream` module provides an API for implementing the stream interface.
5 * There are many stream objects provided by Node.js. For instance, a `request to an HTTP server` and `process.stdout` are both stream instances.
7 * Streams can be readable, writable, or both. All streams are instances of `EventEmitter`.
9 * To access the `stream` module:
12 * const stream = require('stream');
15 * The `stream` module is useful for creating new types of stream instances. It is
16 * usually not necessary to use the `stream` module to consume streams.
17 * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/stream.js)
19 declare module 'stream' {
22 class Readable extends Stream {
23 destroy(error?: Error): this;
25 class Writable extends Stream {
26 destroy(error?: Error): this;
28 class Duplex extends Readable implements Writable {}
32 declare module 'node:stream' {
33 import stream = require('stream');