Merge pull request #107 from TheBlueMatt/main
[ldk-java] / ts / node / stream.d.ts
1 /**
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.
4  *
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.
6  *
7  * Streams can be readable, writable, or both. All streams are instances of `EventEmitter`.
8  *
9  * To access the `stream` module:
10  *
11  * ```js
12  * const stream = require('stream');
13  * ```
14  *
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)
18  */
19 declare module 'stream' {
20     namespace internal {
21         class Stream {}
22         class Readable extends Stream {
23             destroy(error?: Error): this;
24         }
25         class Writable extends Stream {
26             destroy(error?: Error): this;
27         }
28         class Duplex extends Readable implements Writable {}
29     }
30     export = internal;
31 }
32 declare module 'node:stream' {
33     import stream = require('stream');
34     export = stream;
35 }