CoolFace
Apppublic

Pinsave/counterstrike

sourceHugging Faceupdated 3mo agoView on Hugging Face
1likes
stream.d.ts1658 linesDownload Raw Back to node
1/**2 * A stream is an abstract interface for working with streaming data in Node.js.3 * The `node: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](https://nodejs.org/docs/latest-v24.x/api/http.html#class-httpincomingmessage)6 * and [`process.stdout`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstdout) are both stream instances.7 *8 * Streams can be readable, writable, or both. All streams are instances of [`EventEmitter`](https://nodejs.org/docs/latest-v24.x/api/events.html#class-eventemitter).9 *10 * To access the `node:stream` module:11 *12 * ```js13 * import stream from 'node:stream';14 * ```15 *16 * The `node:stream` module is useful for creating new types of stream instances.17 * It is usually not necessary to use the `node:stream` module to consume streams.18 * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/stream.js)19 */20declare module "stream" {21    import { Abortable, EventEmitter } from "node:events";22    import { Blob as NodeBlob } from "node:buffer";23    import * as streamPromises from "node:stream/promises";24    import * as streamWeb from "node:stream/web";25 26    type ComposeFnParam = (source: any) => void;27 28    class Stream extends EventEmitter {29        pipe<T extends NodeJS.WritableStream>(30            destination: T,31            options?: {32                end?: boolean | undefined;33            },34        ): T;35        compose<T extends NodeJS.ReadableStream>(36            stream: T | ComposeFnParam | Iterable<T> | AsyncIterable<T>,37            options?: { signal: AbortSignal },38        ): T;39    }40    namespace Stream {41        export { Stream, streamPromises as promises };42    }43    namespace Stream {44        interface StreamOptions<T extends Stream> extends Abortable {45            emitClose?: boolean | undefined;46            highWaterMark?: number | undefined;47            objectMode?: boolean | undefined;48            construct?(this: T, callback: (error?: Error | null) => void): void;49            destroy?(this: T, error: Error | null, callback: (error?: Error | null) => void): void;50            autoDestroy?: boolean | undefined;51        }52        interface ReadableOptions<T extends Readable = Readable> extends StreamOptions<T> {53            encoding?: BufferEncoding | undefined;54            read?(this: T, size: number): void;55        }56        interface ArrayOptions {57            /**58             * The maximum concurrent invocations of `fn` to call on the stream at once.59             * @default 160             */61            concurrency?: number;62            /** Allows destroying the stream if the signal is aborted. */63            signal?: AbortSignal;64        }65        /**66         * @since v0.9.467         */68        class Readable extends Stream implements NodeJS.ReadableStream {69            /**70             * A utility method for creating Readable Streams out of iterators.71             * @since v12.3.0, v10.17.072             * @param iterable Object implementing the `Symbol.asyncIterator` or `Symbol.iterator` iterable protocol. Emits an 'error' event if a null value is passed.73             * @param options Options provided to `new stream.Readable([options])`. By default, `Readable.from()` will set `options.objectMode` to `true`, unless this is explicitly opted out by setting `options.objectMode` to `false`.74             */75            static from(iterable: Iterable<any> | AsyncIterable<any>, options?: ReadableOptions): Readable;76            /**77             * A utility method for creating a `Readable` from a web `ReadableStream`.78             * @since v17.0.079             */80            static fromWeb(81                readableStream: streamWeb.ReadableStream,82                options?: Pick<ReadableOptions, "encoding" | "highWaterMark" | "objectMode" | "signal">,83            ): Readable;84            /**85             * A utility method for creating a web `ReadableStream` from a `Readable`.86             * @since v17.0.087             */88            static toWeb(89                streamReadable: Readable,90                options?: {91                    strategy?: streamWeb.QueuingStrategy | undefined;92                },93            ): streamWeb.ReadableStream;94            /**95             * Returns whether the stream has been read from or cancelled.96             * @since v16.8.097             */98            static isDisturbed(stream: Readable | NodeJS.ReadableStream): boolean;99            /**100             * Returns whether the stream was destroyed or errored before emitting `'end'`.101             * @since v16.8.0102             */103            readonly readableAborted: boolean;104            /**105             * Is `true` if it is safe to call {@link read}, which means106             * the stream has not been destroyed or emitted `'error'` or `'end'`.107             * @since v11.4.0108             */109            readable: boolean;110            /**111             * Returns whether `'data'` has been emitted.112             * @since v16.7.0, v14.18.0113             */114            readonly readableDidRead: boolean;115            /**116             * Getter for the property `encoding` of a given `Readable` stream. The `encoding` property can be set using the {@link setEncoding} method.117             * @since v12.7.0118             */119            readonly readableEncoding: BufferEncoding | null;120            /**121             * Becomes `true` when [`'end'`](https://nodejs.org/docs/latest-v24.x/api/stream.html#event-end) event is emitted.122             * @since v12.9.0123             */124            readonly readableEnded: boolean;125            /**126             * This property reflects the current state of a `Readable` stream as described127             * in the [Three states](https://nodejs.org/docs/latest-v24.x/api/stream.html#three-states) section.128             * @since v9.4.0129             */130            readonly readableFlowing: boolean | null;131            /**132             * Returns the value of `highWaterMark` passed when creating this `Readable`.133             * @since v9.3.0134             */135            readonly readableHighWaterMark: number;136            /**137             * This property contains the number of bytes (or objects) in the queue138             * ready to be read. The value provides introspection data regarding139             * the status of the `highWaterMark`.140             * @since v9.4.0141             */142            readonly readableLength: number;143            /**144             * Getter for the property `objectMode` of a given `Readable` stream.145             * @since v12.3.0146             */147            readonly readableObjectMode: boolean;148            /**149             * Is `true` after `readable.destroy()` has been called.150             * @since v8.0.0151             */152            destroyed: boolean;153            /**154             * Is `true` after `'close'` has been emitted.155             * @since v18.0.0156             */157            readonly closed: boolean;158            /**159             * Returns error if the stream has been destroyed with an error.160             * @since v18.0.0161             */162            readonly errored: Error | null;163            constructor(opts?: ReadableOptions);164            _construct?(callback: (error?: Error | null) => void): void;165            _read(size: number): void;166            /**167             * The `readable.read()` method reads data out of the internal buffer and168             * returns it. If no data is available to be read, `null` is returned. By default,169             * the data is returned as a `Buffer` object unless an encoding has been170             * specified using the `readable.setEncoding()` method or the stream is operating171             * in object mode.172             *173             * The optional `size` argument specifies a specific number of bytes to read. If174             * `size` bytes are not available to be read, `null` will be returned _unless_ the175             * stream has ended, in which case all of the data remaining in the internal buffer176             * will be returned.177             *178             * If the `size` argument is not specified, all of the data contained in the179             * internal buffer will be returned.180             *181             * The `size` argument must be less than or equal to 1 GiB.182             *183             * The `readable.read()` method should only be called on `Readable` streams184             * operating in paused mode. In flowing mode, `readable.read()` is called185             * automatically until the internal buffer is fully drained.186             *187             * ```js188             * const readable = getReadableStreamSomehow();189             *190             * // 'readable' may be triggered multiple times as data is buffered in191             * readable.on('readable', () => {192             *   let chunk;193             *   console.log('Stream is readable (new data received in buffer)');194             *   // Use a loop to make sure we read all currently available data195             *   while (null !== (chunk = readable.read())) {196             *     console.log(`Read ${chunk.length} bytes of data...`);197             *   }198             * });199             *200             * // 'end' will be triggered once when there is no more data available201             * readable.on('end', () => {202             *   console.log('Reached end of stream.');203             * });204             * ```205             *206             * Each call to `readable.read()` returns a chunk of data, or `null`. The chunks207             * are not concatenated. A `while` loop is necessary to consume all data208             * currently in the buffer. When reading a large file `.read()` may return `null`,209             * having consumed all buffered content so far, but there is still more data to210             * come not yet buffered. In this case a new `'readable'` event will be emitted211             * when there is more data in the buffer. Finally the `'end'` event will be212             * emitted when there is no more data to come.213             *214             * Therefore to read a file's whole contents from a `readable`, it is necessary215             * to collect chunks across multiple `'readable'` events:216             *217             * ```js218             * const chunks = [];219             *220             * readable.on('readable', () => {221             *   let chunk;222             *   while (null !== (chunk = readable.read())) {223             *     chunks.push(chunk);224             *   }225             * });226             *227             * readable.on('end', () => {228             *   const content = chunks.join('');229             * });230             * ```231             *232             * A `Readable` stream in object mode will always return a single item from233             * a call to `readable.read(size)`, regardless of the value of the `size` argument.234             *235             * If the `readable.read()` method returns a chunk of data, a `'data'` event will236             * also be emitted.237             *238             * Calling {@link read} after the `'end'` event has239             * been emitted will return `null`. No runtime error will be raised.240             * @since v0.9.4241             * @param size Optional argument to specify how much data to read.242             */243            read(size?: number): any;244            /**245             * The `readable.setEncoding()` method sets the character encoding for246             * data read from the `Readable` stream.247             *248             * By default, no encoding is assigned and stream data will be returned as `Buffer` objects. Setting an encoding causes the stream data249             * to be returned as strings of the specified encoding rather than as `Buffer` objects. For instance, calling `readable.setEncoding('utf8')` will cause the250             * output data to be interpreted as UTF-8 data, and passed as strings. Calling `readable.setEncoding('hex')` will cause the data to be encoded in hexadecimal251             * string format.252             *253             * The `Readable` stream will properly handle multi-byte characters delivered254             * through the stream that would otherwise become improperly decoded if simply255             * pulled from the stream as `Buffer` objects.256             *257             * ```js258             * const readable = getReadableStreamSomehow();259             * readable.setEncoding('utf8');260             * readable.on('data', (chunk) => {261             *   assert.equal(typeof chunk, 'string');262             *   console.log('Got %d characters of string data:', chunk.length);263             * });264             * ```265             * @since v0.9.4266             * @param encoding The encoding to use.267             */268            setEncoding(encoding: BufferEncoding): this;269            /**270             * The `readable.pause()` method will cause a stream in flowing mode to stop271             * emitting `'data'` events, switching out of flowing mode. Any data that272             * becomes available will remain in the internal buffer.273             *274             * ```js275             * const readable = getReadableStreamSomehow();276             * readable.on('data', (chunk) => {277             *   console.log(`Received ${chunk.length} bytes of data.`);278             *   readable.pause();279             *   console.log('There will be no additional data for 1 second.');280             *   setTimeout(() => {281             *     console.log('Now data will start flowing again.');282             *     readable.resume();283             *   }, 1000);284             * });285             * ```286             *287             * The `readable.pause()` method has no effect if there is a `'readable'` event listener.288             * @since v0.9.4289             */290            pause(): this;291            /**292             * The `readable.resume()` method causes an explicitly paused `Readable` stream to293             * resume emitting `'data'` events, switching the stream into flowing mode.294             *295             * The `readable.resume()` method can be used to fully consume the data from a296             * stream without actually processing any of that data:297             *298             * ```js299             * getReadableStreamSomehow()300             *   .resume()301             *   .on('end', () => {302             *     console.log('Reached the end, but did not read anything.');303             *   });304             * ```305             *306             * The `readable.resume()` method has no effect if there is a `'readable'` event listener.307             * @since v0.9.4308             */309            resume(): this;310            /**311             * The `readable.isPaused()` method returns the current operating state of the `Readable`.312             * This is used primarily by the mechanism that underlies the `readable.pipe()` method.313             * In most typical cases, there will be no reason to use this method directly.314             *315             * ```js316             * const readable = new stream.Readable();317             *318             * readable.isPaused(); // === false319             * readable.pause();320             * readable.isPaused(); // === true321             * readable.resume();322             * readable.isPaused(); // === false323             * ```324             * @since v0.11.14325             */326            isPaused(): boolean;327            /**328             * The `readable.unpipe()` method detaches a `Writable` stream previously attached329             * using the {@link pipe} method.330             *331             * If the `destination` is not specified, then _all_ pipes are detached.332             *333             * If the `destination` is specified, but no pipe is set up for it, then334             * the method does nothing.335             *336             * ```js337             * import fs from 'node:fs';338             * const readable = getReadableStreamSomehow();339             * const writable = fs.createWriteStream('file.txt');340             * // All the data from readable goes into 'file.txt',341             * // but only for the first second.342             * readable.pipe(writable);343             * setTimeout(() => {344             *   console.log('Stop writing to file.txt.');345             *   readable.unpipe(writable);346             *   console.log('Manually close the file stream.');347             *   writable.end();348             * }, 1000);349             * ```350             * @since v0.9.4351             * @param destination Optional specific stream to unpipe352             */353            unpipe(destination?: NodeJS.WritableStream): this;354            /**355             * Passing `chunk` as `null` signals the end of the stream (EOF) and behaves the356             * same as `readable.push(null)`, after which no more data can be written. The EOF357             * signal is put at the end of the buffer and any buffered data will still be358             * flushed.359             *360             * The `readable.unshift()` method pushes a chunk of data back into the internal361             * buffer. This is useful in certain situations where a stream is being consumed by362             * code that needs to "un-consume" some amount of data that it has optimistically363             * pulled out of the source, so that the data can be passed on to some other party.364             *365             * The `stream.unshift(chunk)` method cannot be called after the `'end'` event366             * has been emitted or a runtime error will be thrown.367             *368             * Developers using `stream.unshift()` often should consider switching to369             * use of a `Transform` stream instead. See the `API for stream implementers` section for more information.370             *371             * ```js372             * // Pull off a header delimited by \n\n.373             * // Use unshift() if we get too much.374             * // Call the callback with (error, header, stream).375             * import { StringDecoder } from 'node:string_decoder';376             * function parseHeader(stream, callback) {377             *   stream.on('error', callback);378             *   stream.on('readable', onReadable);379             *   const decoder = new StringDecoder('utf8');380             *   let header = '';381             *   function onReadable() {382             *     let chunk;383             *     while (null !== (chunk = stream.read())) {384             *       const str = decoder.write(chunk);385             *       if (str.includes('\n\n')) {386             *         // Found the header boundary.387             *         const split = str.split(/\n\n/);388             *         header += split.shift();389             *         const remaining = split.join('\n\n');390             *         const buf = Buffer.from(remaining, 'utf8');391             *         stream.removeListener('error', callback);392             *         // Remove the 'readable' listener before unshifting.393             *         stream.removeListener('readable', onReadable);394             *         if (buf.length)395             *           stream.unshift(buf);396             *         // Now the body of the message can be read from the stream.397             *         callback(null, header, stream);398             *         return;399             *       }400             *       // Still reading the header.401             *       header += str;402             *     }403             *   }404             * }405             * ```406             *407             * Unlike {@link push}, `stream.unshift(chunk)` will not408             * end the reading process by resetting the internal reading state of the stream.409             * This can cause unexpected results if `readable.unshift()` is called during a410             * read (i.e. from within a {@link _read} implementation on a411             * custom stream). Following the call to `readable.unshift()` with an immediate {@link push} will reset the reading state appropriately,412             * however it is best to simply avoid calling `readable.unshift()` while in the413             * process of performing a read.414             * @since v0.9.11415             * @param chunk Chunk of data to unshift onto the read queue. For streams not operating in object mode, `chunk` must416             * be a {string}, {Buffer}, {TypedArray}, {DataView} or `null`. For object mode streams, `chunk` may be any JavaScript value.417             * @param encoding Encoding of string chunks. Must be a valid `Buffer` encoding, such as `'utf8'` or `'ascii'`.418             */419            unshift(chunk: any, encoding?: BufferEncoding): void;420            /**421             * Prior to Node.js 0.10, streams did not implement the entire `node:stream` module API as it is currently defined. (See `Compatibility` for more422             * information.)423             *424             * When using an older Node.js library that emits `'data'` events and has a {@link pause} method that is advisory only, the `readable.wrap()` method can be used to create a `Readable`425             * stream that uses426             * the old stream as its data source.427             *428             * It will rarely be necessary to use `readable.wrap()` but the method has been429             * provided as a convenience for interacting with older Node.js applications and430             * libraries.431             *432             * ```js433             * import { OldReader } from './old-api-module.js';434             * import { Readable } from 'node:stream';435             * const oreader = new OldReader();436             * const myReader = new Readable().wrap(oreader);437             *438             * myReader.on('readable', () => {439             *   myReader.read(); // etc.440             * });441             * ```442             * @since v0.9.4443             * @param stream An "old style" readable stream444             */445            wrap(stream: NodeJS.ReadableStream): this;446            push(chunk: any, encoding?: BufferEncoding): boolean;447            /**448             * The iterator created by this method gives users the option to cancel the destruction449             * of the stream if the `for await...of` loop is exited by `return`, `break`, or `throw`,450             * or if the iterator should destroy the stream if the stream emitted an error during iteration.451             * @since v16.3.0452             * @param options.destroyOnReturn When set to `false`, calling `return` on the async iterator,453             * or exiting a `for await...of` iteration using a `break`, `return`, or `throw` will not destroy the stream.454             * **Default: `true`**.455             */456            iterator(options?: { destroyOnReturn?: boolean }): NodeJS.AsyncIterator<any>;457            /**458             * This method allows mapping over the stream. The *fn* function will be called for every chunk in the stream.459             * If the *fn* function returns a promise - that promise will be `await`ed before being passed to the result stream.460             * @since v17.4.0, v16.14.0461             * @param fn a function to map over every chunk in the stream. Async or not.462             * @returns a stream mapped with the function *fn*.463             */464            map(fn: (data: any, options?: Pick<ArrayOptions, "signal">) => any, options?: ArrayOptions): Readable;465            /**466             * This method allows filtering the stream. For each chunk in the stream the *fn* function will be called467             * and if it returns a truthy value, the chunk will be passed to the result stream.468             * If the *fn* function returns a promise - that promise will be `await`ed.469             * @since v17.4.0, v16.14.0470             * @param fn a function to filter chunks from the stream. Async or not.471             * @returns a stream filtered with the predicate *fn*.472             */473            filter(474                fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>,475                options?: ArrayOptions,476            ): Readable;477            /**478             * This method allows iterating a stream. For each chunk in the stream the *fn* function will be called.479             * If the *fn* function returns a promise - that promise will be `await`ed.480             *481             * This method is different from `for await...of` loops in that it can optionally process chunks concurrently.482             * In addition, a `forEach` iteration can only be stopped by having passed a `signal` option483             * and aborting the related AbortController while `for await...of` can be stopped with `break` or `return`.484             * In either case the stream will be destroyed.485             *486             * This method is different from listening to the `'data'` event in that it uses the `readable` event487             * in the underlying machinary and can limit the number of concurrent *fn* calls.488             * @since v17.5.0489             * @param fn a function to call on each chunk of the stream. Async or not.490             * @returns a promise for when the stream has finished.491             */492            forEach(493                fn: (data: any, options?: Pick<ArrayOptions, "signal">) => void | Promise<void>,494                options?: ArrayOptions,495            ): Promise<void>;496            /**497             * This method allows easily obtaining the contents of a stream.498             *499             * As this method reads the entire stream into memory, it negates the benefits of streams. It's intended500             * for interoperability and convenience, not as the primary way to consume streams.501             * @since v17.5.0502             * @returns a promise containing an array with the contents of the stream.503             */504            toArray(options?: Pick<ArrayOptions, "signal">): Promise<any[]>;505            /**506             * This method is similar to `Array.prototype.some` and calls *fn* on each chunk in the stream507             * until the awaited return value is `true` (or any truthy value). Once an *fn* call on a chunk508             * `await`ed return value is truthy, the stream is destroyed and the promise is fulfilled with `true`.509             * If none of the *fn* calls on the chunks return a truthy value, the promise is fulfilled with `false`.510             * @since v17.5.0511             * @param fn a function to call on each chunk of the stream. Async or not.512             * @returns a promise evaluating to `true` if *fn* returned a truthy value for at least one of the chunks.513             */514            some(515                fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>,516                options?: ArrayOptions,517            ): Promise<boolean>;518            /**519             * This method is similar to `Array.prototype.find` and calls *fn* on each chunk in the stream520             * to find a chunk with a truthy value for *fn*. Once an *fn* call's awaited return value is truthy,521             * the stream is destroyed and the promise is fulfilled with value for which *fn* returned a truthy value.522             * If all of the *fn* calls on the chunks return a falsy value, the promise is fulfilled with `undefined`.523             * @since v17.5.0524             * @param fn a function to call on each chunk of the stream. Async or not.525             * @returns a promise evaluating to the first chunk for which *fn* evaluated with a truthy value,526             * or `undefined` if no element was found.527             */528            find<T>(529                fn: (data: any, options?: Pick<ArrayOptions, "signal">) => data is T,530                options?: ArrayOptions,531            ): Promise<T | undefined>;532            find(533                fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>,534                options?: ArrayOptions,535            ): Promise<any>;536            /**537             * This method is similar to `Array.prototype.every` and calls *fn* on each chunk in the stream538             * to check if all awaited return values are truthy value for *fn*. Once an *fn* call on a chunk539             * `await`ed return value is falsy, the stream is destroyed and the promise is fulfilled with `false`.540             * If all of the *fn* calls on the chunks return a truthy value, the promise is fulfilled with `true`.541             * @since v17.5.0542             * @param fn a function to call on each chunk of the stream. Async or not.543             * @returns a promise evaluating to `true` if *fn* returned a truthy value for every one of the chunks.544             */545            every(546                fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>,547                options?: ArrayOptions,548            ): Promise<boolean>;549            /**550             * This method returns a new stream by applying the given callback to each chunk of the stream551             * and then flattening the result.552             *553             * It is possible to return a stream or another iterable or async iterable from *fn* and the result streams554             * will be merged (flattened) into the returned stream.555             * @since v17.5.0556             * @param fn a function to map over every chunk in the stream. May be async. May be a stream or generator.557             * @returns a stream flat-mapped with the function *fn*.558             */559            flatMap(fn: (data: any, options?: Pick<ArrayOptions, "signal">) => any, options?: ArrayOptions): Readable;560            /**561             * This method returns a new stream with the first *limit* chunks dropped from the start.562             * @since v17.5.0563             * @param limit the number of chunks to drop from the readable.564             * @returns a stream with *limit* chunks dropped from the start.565             */566            drop(limit: number, options?: Pick<ArrayOptions, "signal">): Readable;567            /**568             * This method returns a new stream with the first *limit* chunks.569             * @since v17.5.0570             * @param limit the number of chunks to take from the readable.571             * @returns a stream with *limit* chunks taken.572             */573            take(limit: number, options?: Pick<ArrayOptions, "signal">): Readable;574            /**575             * This method returns a new stream with chunks of the underlying stream paired with a counter576             * in the form `[index, chunk]`. The first index value is `0` and it increases by 1 for each chunk produced.577             * @since v17.5.0578             * @returns a stream of indexed pairs.579             */580            asIndexedPairs(options?: Pick<ArrayOptions, "signal">): Readable;581            /**582             * This method calls *fn* on each chunk of the stream in order, passing it the result from the calculation583             * on the previous element. It returns a promise for the final value of the reduction.584             *585             * If no *initial* value is supplied the first chunk of the stream is used as the initial value.586             * If the stream is empty, the promise is rejected with a `TypeError` with the `ERR_INVALID_ARGS` code property.587             *588             * The reducer function iterates the stream element-by-element which means that there is no *concurrency* parameter589             * or parallelism. To perform a reduce concurrently, you can extract the async function to `readable.map` method.590             * @since v17.5.0591             * @param fn a reducer function to call over every chunk in the stream. Async or not.592             * @param initial the initial value to use in the reduction.593             * @returns a promise for the final value of the reduction.594             */595            reduce<T = any>(596                fn: (previous: any, data: any, options?: Pick<ArrayOptions, "signal">) => T,597                initial?: undefined,598                options?: Pick<ArrayOptions, "signal">,599            ): Promise<T>;600            reduce<T = any>(601                fn: (previous: T, data: any, options?: Pick<ArrayOptions, "signal">) => T,602                initial: T,603                options?: Pick<ArrayOptions, "signal">,604            ): Promise<T>;605            _destroy(error: Error | null, callback: (error?: Error | null) => void): void;606            /**607             * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'` event (unless `emitClose` is set to `false`). After this call, the readable608             * stream will release any internal resources and subsequent calls to `push()` will be ignored.609             *610             * Once `destroy()` has been called any further calls will be a no-op and no611             * further errors except from `_destroy()` may be emitted as `'error'`.612             *613             * Implementors should not override this method, but instead implement `readable._destroy()`.614             * @since v8.0.0615             * @param error Error which will be passed as payload in `'error'` event616             */617            destroy(error?: Error): this;618            /**619             * Event emitter620             * The defined events on documents including:621             * 1. close622             * 2. data623             * 3. end624             * 4. error625             * 5. pause626             * 6. readable627             * 7. resume628             */629            addListener(event: "close", listener: () => void): this;630            addListener(event: "data", listener: (chunk: any) => void): this;631            addListener(event: "end", listener: () => void): this;632            addListener(event: "error", listener: (err: Error) => void): this;633            addListener(event: "pause", listener: () => void): this;634            addListener(event: "readable", listener: () => void): this;635            addListener(event: "resume", listener: () => void): this;636            addListener(event: string | symbol, listener: (...args: any[]) => void): this;637            emit(event: "close"): boolean;638            emit(event: "data", chunk: any): boolean;639            emit(event: "end"): boolean;640            emit(event: "error", err: Error): boolean;641            emit(event: "pause"): boolean;642            emit(event: "readable"): boolean;643            emit(event: "resume"): boolean;644            emit(event: string | symbol, ...args: any[]): boolean;645            on(event: "close", listener: () => void): this;646            on(event: "data", listener: (chunk: any) => void): this;647            on(event: "end", listener: () => void): this;648            on(event: "error", listener: (err: Error) => void): this;649            on(event: "pause", listener: () => void): this;650            on(event: "readable", listener: () => void): this;651            on(event: "resume", listener: () => void): this;652            on(event: string | symbol, listener: (...args: any[]) => void): this;653            once(event: "close", listener: () => void): this;654            once(event: "data", listener: (chunk: any) => void): this;655            once(event: "end", listener: () => void): this;656            once(event: "error", listener: (err: Error) => void): this;657            once(event: "pause", listener: () => void): this;658            once(event: "readable", listener: () => void): this;659            once(event: "resume", listener: () => void): this;660            once(event: string | symbol, listener: (...args: any[]) => void): this;661            prependListener(event: "close", listener: () => void): this;662            prependListener(event: "data", listener: (chunk: any) => void): this;663            prependListener(event: "end", listener: () => void): this;664            prependListener(event: "error", listener: (err: Error) => void): this;665            prependListener(event: "pause", listener: () => void): this;666            prependListener(event: "readable", listener: () => void): this;667            prependListener(event: "resume", listener: () => void): this;668            prependListener(event: string | symbol, listener: (...args: any[]) => void): this;669            prependOnceListener(event: "close", listener: () => void): this;670            prependOnceListener(event: "data", listener: (chunk: any) => void): this;671            prependOnceListener(event: "end", listener: () => void): this;672            prependOnceListener(event: "error", listener: (err: Error) => void): this;673            prependOnceListener(event: "pause", listener: () => void): this;674            prependOnceListener(event: "readable", listener: () => void): this;675            prependOnceListener(event: "resume", listener: () => void): this;676            prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;677            removeListener(event: "close", listener: () => void): this;678            removeListener(event: "data", listener: (chunk: any) => void): this;679            removeListener(event: "end", listener: () => void): this;680            removeListener(event: "error", listener: (err: Error) => void): this;681            removeListener(event: "pause", listener: () => void): this;682            removeListener(event: "readable", listener: () => void): this;683            removeListener(event: "resume", listener: () => void): this;684            removeListener(event: string | symbol, listener: (...args: any[]) => void): this;685            [Symbol.asyncIterator](): NodeJS.AsyncIterator<any>;686            /**687             * Calls `readable.destroy()` with an `AbortError` and returns a promise that fulfills when the stream is finished.688             * @since v20.4.0689             */690            [Symbol.asyncDispose](): Promise<void>;691        }692        interface WritableOptions<T extends Writable = Writable> extends StreamOptions<T> {693            decodeStrings?: boolean | undefined;694            defaultEncoding?: BufferEncoding | undefined;695            write?(696                this: T,697                chunk: any,698                encoding: BufferEncoding,699                callback: (error?: Error | null) => void,700            ): void;701            writev?(702                this: T,703                chunks: Array<{704                    chunk: any;705                    encoding: BufferEncoding;706                }>,707                callback: (error?: Error | null) => void,708            ): void;709            final?(this: T, callback: (error?: Error | null) => void): void;710        }711        /**712         * @since v0.9.4713         */714        class Writable extends Stream implements NodeJS.WritableStream {715            /**716             * A utility method for creating a `Writable` from a web `WritableStream`.717             * @since v17.0.0718             */719            static fromWeb(720                writableStream: streamWeb.WritableStream,721                options?: Pick<WritableOptions, "decodeStrings" | "highWaterMark" | "objectMode" | "signal">,722            ): Writable;723            /**724             * A utility method for creating a web `WritableStream` from a `Writable`.725             * @since v17.0.0726             */727            static toWeb(streamWritable: Writable): streamWeb.WritableStream;728            /**729             * Is `true` if it is safe to call `writable.write()`, which means730             * the stream has not been destroyed, errored, or ended.731             * @since v11.4.0732             */733            readonly writable: boolean;734            /**735             * Returns whether the stream was destroyed or errored before emitting `'finish'`.736             * @since v18.0.0, v16.17.0737             */738            readonly writableAborted: boolean;739            /**740             * Is `true` after `writable.end()` has been called. This property741             * does not indicate whether the data has been flushed, for this use `writable.writableFinished` instead.742             * @since v12.9.0743             */744            readonly writableEnded: boolean;745            /**746             * Is set to `true` immediately before the `'finish'` event is emitted.747             * @since v12.6.0748             */749            readonly writableFinished: boolean;750            /**751             * Return the value of `highWaterMark` passed when creating this `Writable`.752             * @since v9.3.0753             */754            readonly writableHighWaterMark: number;755            /**756             * This property contains the number of bytes (or objects) in the queue757             * ready to be written. The value provides introspection data regarding758             * the status of the `highWaterMark`.759             * @since v9.4.0760             */761            readonly writableLength: number;762            /**763             * Getter for the property `objectMode` of a given `Writable` stream.764             * @since v12.3.0765             */766            readonly writableObjectMode: boolean;767            /**768             * Number of times `writable.uncork()` needs to be769             * called in order to fully uncork the stream.770             * @since v13.2.0, v12.16.0771             */772            readonly writableCorked: number;773            /**774             * Is `true` after `writable.destroy()` has been called.775             * @since v8.0.0776             */777            destroyed: boolean;778            /**779             * Is `true` after `'close'` has been emitted.780             * @since v18.0.0781             */782            readonly closed: boolean;783            /**784             * Returns error if the stream has been destroyed with an error.785             * @since v18.0.0786             */787            readonly errored: Error | null;788            /**789             * Is `true` if the stream's buffer has been full and stream will emit `'drain'`.790             * @since v15.2.0, v14.17.0791             */792            readonly writableNeedDrain: boolean;793            constructor(opts?: WritableOptions);794            _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;795            _writev?(796                chunks: Array<{797                    chunk: any;798                    encoding: BufferEncoding;799                }>,800                callback: (error?: Error | null) => void,801            ): void;802            _construct?(callback: (error?: Error | null) => void): void;803            _destroy(error: Error | null, callback: (error?: Error | null) => void): void;804            _final(callback: (error?: Error | null) => void): void;805            /**806             * The `writable.write()` method writes some data to the stream, and calls the807             * supplied `callback` once the data has been fully handled. If an error808             * occurs, the `callback` will be called with the error as its809             * first argument. The `callback` is called asynchronously and before `'error'` is810             * emitted.811             *812             * The return value is `true` if the internal buffer is less than the `highWaterMark` configured when the stream was created after admitting `chunk`.813             * If `false` is returned, further attempts to write data to the stream should814             * stop until the `'drain'` event is emitted.815             *816             * While a stream is not draining, calls to `write()` will buffer `chunk`, and817             * return false. Once all currently buffered chunks are drained (accepted for818             * delivery by the operating system), the `'drain'` event will be emitted.819             * Once `write()` returns false, do not write more chunks820             * until the `'drain'` event is emitted. While calling `write()` on a stream that821             * is not draining is allowed, Node.js will buffer all written chunks until822             * maximum memory usage occurs, at which point it will abort unconditionally.823             * Even before it aborts, high memory usage will cause poor garbage collector824             * performance and high RSS (which is not typically released back to the system,825             * even after the memory is no longer required). Since TCP sockets may never826             * drain if the remote peer does not read the data, writing a socket that is827             * not draining may lead to a remotely exploitable vulnerability.828             *829             * Writing data while the stream is not draining is particularly830             * problematic for a `Transform`, because the `Transform` streams are paused831             * by default until they are piped or a `'data'` or `'readable'` event handler832             * is added.833             *834             * If the data to be written can be generated or fetched on demand, it is835             * recommended to encapsulate the logic into a `Readable` and use {@link pipe}. However, if calling `write()` is preferred, it is836             * possible to respect backpressure and avoid memory issues using the `'drain'` event:837             *838             * ```js839             * function write(data, cb) {840             *   if (!stream.write(data)) {841             *     stream.once('drain', cb);842             *   } else {843             *     process.nextTick(cb);844             *   }845             * }846             *847             * // Wait for cb to be called before doing any other write.848             * write('hello', () => {849             *   console.log('Write completed, do more writes now.');850             * });851             * ```852             *853             * A `Writable` stream in object mode will always ignore the `encoding` argument.854             * @since v0.9.4855             * @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a {string}, {Buffer},856             * {TypedArray} or {DataView}. For object mode streams, `chunk` may be any JavaScript value other than `null`.857             * @param [encoding='utf8'] The encoding, if `chunk` is a string.858             * @param callback Callback for when this chunk of data is flushed.859             * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.860             */861            write(chunk: any, callback?: (error: Error | null | undefined) => void): boolean;862            write(chunk: any, encoding: BufferEncoding, callback?: (error: Error | null | undefined) => void): boolean;863            /**864             * The `writable.setDefaultEncoding()` method sets the default `encoding` for a `Writable` stream.865             * @since v0.11.15866             * @param encoding The new default encoding867             */868            setDefaultEncoding(encoding: BufferEncoding): this;869            /**870             * Calling the `writable.end()` method signals that no more data will be written871             * to the `Writable`. The optional `chunk` and `encoding` arguments allow one872             * final additional chunk of data to be written immediately before closing the873             * stream.874             *875             * Calling the {@link write} method after calling {@link end} will raise an error.876             *877             * ```js878             * // Write 'hello, ' and then end with 'world!'.879             * import fs from 'node:fs';880             * const file = fs.createWriteStream('example.txt');881             * file.write('hello, ');882             * file.end('world!');883             * // Writing more now is not allowed!884             * ```885             * @since v0.9.4886             * @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a {string}, {Buffer},887             * {TypedArray} or {DataView}. For object mode streams, `chunk` may be any JavaScript value other than `null`.888             * @param encoding The encoding if `chunk` is a string889             * @param callback Callback for when the stream is finished.890             */891            end(cb?: () => void): this;892            end(chunk: any, cb?: () => void): this;893            end(chunk: any, encoding: BufferEncoding, cb?: () => void): this;894            /**895             * The `writable.cork()` method forces all written data to be buffered in memory.896             * The buffered data will be flushed when either the {@link uncork} or {@link end} methods are called.897             *898             * The primary intent of `writable.cork()` is to accommodate a situation in which899             * several small chunks are written to the stream in rapid succession. Instead of900             * immediately forwarding them to the underlying destination, `writable.cork()` buffers all the chunks until `writable.uncork()` is called, which will pass them901             * all to `writable._writev()`, if present. This prevents a head-of-line blocking902             * situation where data is being buffered while waiting for the first small chunk903             * to be processed. However, use of `writable.cork()` without implementing `writable._writev()` may have an adverse effect on throughput.904             *905             * See also: `writable.uncork()`, `writable._writev()`.906             * @since v0.11.2907             */908            cork(): void;909            /**910             * The `writable.uncork()` method flushes all data buffered since {@link cork} was called.911             *912             * When using `writable.cork()` and `writable.uncork()` to manage the buffering913             * of writes to a stream, defer calls to `writable.uncork()` using `process.nextTick()`. Doing so allows batching of all `writable.write()` calls that occur within a given Node.js event914             * loop phase.915             *916             * ```js917             * stream.cork();918             * stream.write('some ');919             * stream.write('data ');920             * process.nextTick(() => stream.uncork());921             * ```922             *923             * If the `writable.cork()` method is called multiple times on a stream, the924             * same number of calls to `writable.uncork()` must be called to flush the buffered925             * data.926             *927             * ```js928             * stream.cork();929             * stream.write('some ');930             * stream.cork();931             * stream.write('data ');932             * process.nextTick(() => {933             *   stream.uncork();934             *   // The data will not be flushed until uncork() is called a second time.935             *   stream.uncork();936             * });937             * ```938             *939             * See also: `writable.cork()`.940             * @since v0.11.2941             */942            uncork(): void;943            /**944             * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'` event (unless `emitClose` is set to `false`). After this call, the writable945             * stream has ended and subsequent calls to `write()` or `end()` will result in946             * an `ERR_STREAM_DESTROYED` error.947             * This is a destructive and immediate way to destroy a stream. Previous calls to `write()` may not have drained, and may trigger an `ERR_STREAM_DESTROYED` error.948             * Use `end()` instead of destroy if data should flush before close, or wait for949             * the `'drain'` event before destroying the stream.950             *951             * Once `destroy()` has been called any further calls will be a no-op and no952             * further errors except from `_destroy()` may be emitted as `'error'`.953             *954             * Implementors should not override this method,955             * but instead implement `writable._destroy()`.956             * @since v8.0.0957             * @param error Optional, an error to emit with `'error'` event.958             */959            destroy(error?: Error): this;960            /**961             * Event emitter962             * The defined events on documents including:963             * 1. close964             * 2. drain965             * 3. error966             * 4. finish967             * 5. pipe968             * 6. unpipe969             */970            addListener(event: "close", listener: () => void): this;971            addListener(event: "drain", listener: () => void): this;972            addListener(event: "error", listener: (err: Error) => void): this;973            addListener(event: "finish", listener: () => void): this;974            addListener(event: "pipe", listener: (src: Readable) => void): this;975            addListener(event: "unpipe", listener: (src: Readable) => void): this;976            addListener(event: string | symbol, listener: (...args: any[]) => void): this;977            emit(event: "close"): boolean;978            emit(event: "drain"): boolean;979            emit(event: "error", err: Error): boolean;980            emit(event: "finish"): boolean;981            emit(event: "pipe", src: Readable): boolean;982            emit(event: "unpipe", src: Readable): boolean;983            emit(event: string | symbol, ...args: any[]): boolean;984            on(event: "close", listener: () => void): this;985            on(event: "drain", listener: () => void): this;986            on(event: "error", listener: (err: Error) => void): this;987            on(event: "finish", listener: () => void): this;988            on(event: "pipe", listener: (src: Readable) => void): this;989            on(event: "unpipe", listener: (src: Readable) => void): this;990            on(event: string | symbol, listener: (...args: any[]) => void): this;991            once(event: "close", listener: () => void): this;992            once(event: "drain", listener: () => void): this;993            once(event: "error", listener: (err: Error) => void): this;994            once(event: "finish", listener: () => void): this;995            once(event: "pipe", listener: (src: Readable) => void): this;996            once(event: "unpipe", listener: (src: Readable) => void): this;997            once(event: string | symbol, listener: (...args: any[]) => void): this;998            prependListener(event: "close", listener: () => void): this;999            prependListener(event: "drain", listener: () => void): this;1000            prependListener(event: "error", listener: (err: Error) => void): this;1001            prependListener(event: "finish", listener: () => void): this;1002            prependListener(event: "pipe", listener: (src: Readable) => void): this;1003            prependListener(event: "unpipe", listener: (src: Readable) => void): this;1004            prependListener(event: string | symbol, listener: (...args: any[]) => void): this;1005            prependOnceListener(event: "close", listener: () => void): this;1006            prependOnceListener(event: "drain", listener: () => void): this;1007            prependOnceListener(event: "error", listener: (err: Error) => void): this;1008            prependOnceListener(event: "finish", listener: () => void): this;1009            prependOnceListener(event: "pipe", listener: (src: Readable) => void): this;1010            prependOnceListener(event: "unpipe", listener: (src: Readable) => void): this;1011            prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;1012            removeListener(event: "close", listener: () => void): this;1013            removeListener(event: "drain", listener: () => void): this;1014            removeListener(event: "error", listener: (err: Error) => void): this;1015            removeListener(event: "finish", listener: () => void): this;1016            removeListener(event: "pipe", listener: (src: Readable) => void): this;1017            removeListener(event: "unpipe", listener: (src: Readable) => void): this;1018            removeListener(event: string | symbol, listener: (...args: any[]) => void): this;1019        }1020        interface DuplexOptions<T extends Duplex = Duplex> extends ReadableOptions<T>, WritableOptions<T> {1021            allowHalfOpen?: boolean | undefined;1022            readableObjectMode?: boolean | undefined;1023            writableObjectMode?: boolean | undefined;1024            readableHighWaterMark?: number | undefined;1025            writableHighWaterMark?: number | undefined;1026            writableCorked?: number | undefined;1027        }1028        /**1029         * Duplex streams are streams that implement both the `Readable` and `Writable` interfaces.1030         *1031         * Examples of `Duplex` streams include:1032         *1033         * * `TCP sockets`1034         * * `zlib streams`1035         * * `crypto streams`1036         * @since v0.9.41037         */1038        class Duplex extends Stream implements NodeJS.ReadWriteStream {1039            /**1040             * If `false` then the stream will automatically end the writable side when the1041             * readable side ends. Set initially by the `allowHalfOpen` constructor option,1042             * which defaults to `true`.1043             *1044             * This can be changed manually to change the half-open behavior of an existing1045             * `Duplex` stream instance, but must be changed before the `'end'` event is emitted.1046             * @since v0.9.41047             */1048            allowHalfOpen: boolean;1049            constructor(opts?: DuplexOptions);1050            /**1051             * A utility method for creating duplex streams.1052             *1053             * - `Stream` converts writable stream into writable `Duplex` and readable stream1054             *   to `Duplex`.1055             * - `Blob` converts into readable `Duplex`.1056             * - `string` converts into readable `Duplex`.1057             * - `ArrayBuffer` converts into readable `Duplex`.1058             * - `AsyncIterable` converts into a readable `Duplex`. Cannot yield `null`.1059             * - `AsyncGeneratorFunction` converts into a readable/writable transform1060             *   `Duplex`. Must take a source `AsyncIterable` as first parameter. Cannot yield1061             *   `null`.1062             * - `AsyncFunction` converts into a writable `Duplex`. Must return1063             *   either `null` or `undefined`1064             * - `Object ({ writable, readable })` converts `readable` and1065             *   `writable` into `Stream` and then combines them into `Duplex` where the1066             *   `Duplex` will write to the `writable` and read from the `readable`.1067             * - `Promise` converts into readable `Duplex`. Value `null` is ignored.1068             *1069             * @since v16.8.01070             */1071            static from(1072                src:1073                    | Stream1074                    | NodeBlob1075                    | ArrayBuffer1076                    | string1077                    | Iterable<any>1078                    | AsyncIterable<any>1079                    | AsyncGeneratorFunction1080                    | Promise<any>1081                    | Object,1082            ): Duplex;1083            /**1084             * A utility method for creating a web `ReadableStream` and `WritableStream` from a `Duplex`.1085             * @since v17.0.01086             */1087            static toWeb(streamDuplex: Duplex): {1088                readable: streamWeb.ReadableStream;1089                writable: streamWeb.WritableStream;1090            };1091            /**1092             * A utility method for creating a `Duplex` from a web `ReadableStream` and `WritableStream`.1093             * @since v17.0.01094             */1095            static fromWeb(1096                duplexStream: {1097                    readable: streamWeb.ReadableStream;1098                    writable: streamWeb.WritableStream;1099                },1100                options?: Pick<1101                    DuplexOptions,1102                    "allowHalfOpen" | "decodeStrings" | "encoding" | "highWaterMark" | "objectMode" | "signal"1103                >,1104            ): Duplex;1105            /**1106             * Event emitter1107             * The defined events on documents including:1108             * 1.  close1109             * 2.  data1110             * 3.  drain1111             * 4.  end1112             * 5.  error1113             * 6.  finish1114             * 7.  pause1115             * 8.  pipe1116             * 9.  readable1117             * 10. resume1118             * 11. unpipe1119             */1120            addListener(event: "close", listener: () => void): this;1121            addListener(event: "data", listener: (chunk: any) => void): this;1122            addListener(event: "drain", listener: () => void): this;1123            addListener(event: "end", listener: () => void): this;1124            addListener(event: "error", listener: (err: Error) => void): this;1125            addListener(event: "finish", listener: () => void): this;1126            addListener(event: "pause", listener: () => void): this;1127            addListener(event: "pipe", listener: (src: Readable) => void): this;1128            addListener(event: "readable", listener: () => void): this;1129            addListener(event: "resume", listener: () => void): this;1130            addListener(event: "unpipe", listener: (src: Readable) => void): this;1131            addListener(event: string | symbol, listener: (...args: any[]) => void): this;1132            emit(event: "close"): boolean;1133            emit(event: "data", chunk: any): boolean;1134            emit(event: "drain"): boolean;1135            emit(event: "end"): boolean;1136            emit(event: "error", err: Error): boolean;1137            emit(event: "finish"): boolean;1138            emit(event: "pause"): boolean;1139            emit(event: "pipe", src: Readable): boolean;1140            emit(event: "readable"): boolean;1141            emit(event: "resume"): boolean;1142            emit(event: "unpipe", src: Readable): boolean;1143            emit(event: string | symbol, ...args: any[]): boolean;1144            on(event: "close", listener: () => void): this;1145            on(event: "data", listener: (chunk: any) => void): this;1146            on(event: "drain", listener: () => void): this;1147            on(event: "end", listener: () => void): this;1148            on(event: "error", listener: (err: Error) => void): this;1149            on(event: "finish", listener: () => void): this;1150            on(event: "pause", listener: () => void): this;1151            on(event: "pipe", listener: (src: Readable) => void): this;1152            on(event: "readable", listener: () => void): this;1153            on(event: "resume", listener: () => void): this;1154            on(event: "unpipe", listener: (src: Readable) => void): this;1155            on(event: string | symbol, listener: (...args: any[]) => void): this;1156            once(event: "close", listener: () => void): this;1157            once(event: "data", listener: (chunk: any) => void): this;1158            once(event: "drain", listener: () => void): this;1159            once(event: "end", listener: () => void): this;1160            once(event: "error", listener: (err: Error) => void): this;1161            once(event: "finish", listener: () => void): this;1162            once(event: "pause", listener: () => void): this;1163            once(event: "pipe", listener: (src: Readable) => void): this;1164            once(event: "readable", listener: () => void): this;1165            once(event: "resume", listener: () => void): this;1166            once(event: "unpipe", listener: (src: Readable) => void): this;1167            once(event: string | symbol, listener: (...args: any[]) => void): this;1168            prependListener(event: "close", listener: () => void): this;1169            prependListener(event: "data", listener: (chunk: any) => void): this;1170            prependListener(event: "drain", listener: () => void): this;1171            prependListener(event: "end", listener: () => void): this;1172            prependListener(event: "error", listener: (err: Error) => void): this;1173            prependListener(event: "finish", listener: () => void): this;1174            prependListener(event: "pause", listener: () => void): this;1175            prependListener(event: "pipe", listener: (src: Readable) => void): this;1176            prependListener(event: "readable", listener: () => void): this;1177            prependListener(event: "resume", listener: () => void): this;1178            prependListener(event: "unpipe", listener: (src: Readable) => void): this;1179            prependListener(event: string | symbol, listener: (...args: any[]) => void): this;1180            prependOnceListener(event: "close", listener: () => void): this;1181            prependOnceListener(event: "data", listener: (chunk: any) => void): this;1182            prependOnceListener(event: "drain", listener: () => void): this;1183            prependOnceListener(event: "end", listener: () => void): this;1184            prependOnceListener(event: "error", listener: (err: Error) => void): this;1185            prependOnceListener(event: "finish", listener: () => void): this;1186            prependOnceListener(event: "pause", listener: () => void): this;1187            prependOnceListener(event: "pipe", listener: (src: Readable) => void): this;1188            prependOnceListener(event: "readable", listener: () => void): this;1189            prependOnceListener(event: "resume", listener: () => void): this;1190            prependOnceListener(event: "unpipe", listener: (src: Readable) => void): this;1191            prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;1192            removeListener(event: "close", listener: () => void): this;1193            removeListener(event: "data", listener: (chunk: any) => void): this;1194            removeListener(event: "drain", listener: () => void): this;1195            removeListener(event: "end", listener: () => void): this;1196            removeListener(event: "error", listener: (err: Error) => void): this;1197            removeListener(event: "finish", listener: () => void): this;1198            removeListener(event: "pause", listener: () => void): this;1199            removeListener(event: "pipe", listener: (src: Readable) => void): this;1200            removeListener(event: "readable", listener: () => void): this;

Showing the first 1,200 of 1658 lines. Download the file for the rest.