From 3bd962a6d7f61239c020e2dbbeb7341e5b842dd1 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期二, 21 四月 2026 11:46:41 +0800
Subject: [PATCH] 推送
---
node_modules/@types/node/stream.d.ts | 70 +++++++++++++++++++++--------------
1 files changed, 42 insertions(+), 28 deletions(-)
diff --git a/node_modules/@types/node/stream.d.ts b/node_modules/@types/node/stream.d.ts
index 79ad890..1591667 100644
--- a/node_modules/@types/node/stream.d.ts
+++ b/node_modules/@types/node/stream.d.ts
@@ -1,22 +1,3 @@
-/**
- * A stream is an abstract interface for working with streaming data in Node.js.
- * The `node:stream` module provides an API for implementing the stream interface.
- *
- * There are many stream objects provided by Node.js. For instance, a [request to an HTTP server](https://nodejs.org/docs/latest-v25.x/api/http.html#class-httpincomingmessage)
- * and [`process.stdout`](https://nodejs.org/docs/latest-v25.x/api/process.html#processstdout) are both stream instances.
- *
- * Streams can be readable, writable, or both. All streams are instances of [`EventEmitter`](https://nodejs.org/docs/latest-v25.x/api/events.html#class-eventemitter).
- *
- * To access the `node:stream` module:
- *
- * ```js
- * import stream from 'node:stream';
- * ```
- *
- * The `node:stream` module is useful for creating new types of stream instances.
- * It is usually not necessary to use the `node:stream` module to consume streams.
- * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/stream.js)
- */
declare module "node:stream" {
import { Blob } from "node:buffer";
import { Abortable, EventEmitter } from "node:events";
@@ -81,6 +62,7 @@
interface ArrayOptions extends ReadableOperatorOptions {}
interface ReadableToWebOptions {
strategy?: web.QueuingStrategy | undefined;
+ type?: web.ReadableStreamType | undefined;
}
interface ReadableEventMap {
"close": [];
@@ -485,13 +467,18 @@
* }
* }
*
- * const wordsStream = Readable.from(['this is', 'compose as operator']).compose(splitToWords);
+ * const wordsStream = Readable.from(['text passed through', 'composed stream']).compose(splitToWords);
* const words = await wordsStream.toArray();
*
- * console.log(words); // prints ['this', 'is', 'compose', 'as', 'operator']
+ * console.log(words); // prints ['text', 'passed', 'through', 'composed', 'stream']
* ```
*
- * See [`stream.compose`](https://nodejs.org/docs/latest-v25.x/api/stream.html#streamcomposestreams) for more information.
+ * `readable.compose(s)` is equivalent to `stream.compose(readable, s)`.
+ *
+ * This method also allows for an `AbortSignal` to be provided, which will destroy
+ * the composed stream when aborted.
+ *
+ * See [`stream.compose(...streams)`](https://nodejs.org/docs/latest-v25.x/api/stream.html#streamcomposestreams) for more information.
* @since v19.1.0, v18.13.0
* @returns a stream composed with the stream `stream`.
*/
@@ -893,11 +880,20 @@
* @since v0.9.4
* @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a {string}, {Buffer},
* {TypedArray} or {DataView}. For object mode streams, `chunk` may be any JavaScript value other than `null`.
- * @param [encoding='utf8'] The encoding, if `chunk` is a string.
* @param callback Callback for when this chunk of data is flushed.
* @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`.
*/
write(chunk: any, callback?: (error: Error | null | undefined) => void): boolean;
+ /**
+ * Writes data to the stream, with an explicit encoding for string data.
+ * @see {@link Writable.write} for full details.
+ * @since v0.9.4
+ * @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a {string}, {Buffer},
+ * {TypedArray} or {DataView}. For object mode streams, `chunk` may be any JavaScript value other than `null`.
+ * @param encoding The encoding, if `chunk` is a string.
+ * @param callback Callback for when this chunk of data is flushed.
+ * @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`.
+ */
write(chunk: any, encoding: BufferEncoding, callback?: (error: Error | null | undefined) => void): boolean;
/**
* The `writable.setDefaultEncoding()` method sets the default `encoding` for a `Writable` stream.
@@ -922,13 +918,27 @@
* // Writing more now is not allowed!
* ```
* @since v0.9.4
+ * @param cb Callback for when the stream is finished.
+ */
+ end(cb?: () => void): this;
+ /**
+ * Signals that no more data will be written, with one final chunk of data.
+ * @see {@link Writable.end} for full details.
+ * @since v0.9.4
+ * @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a {string}, {Buffer},
+ * {TypedArray} or {DataView}. For object mode streams, `chunk` may be any JavaScript value other than `null`.
+ * @param cb Callback for when the stream is finished.
+ */
+ end(chunk: any, cb?: () => void): this;
+ /**
+ * Signals that no more data will be written, with one final chunk of data.
+ * @see {@link Writable.end} for full details.
+ * @since v0.9.4
* @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a {string}, {Buffer},
* {TypedArray} or {DataView}. For object mode streams, `chunk` may be any JavaScript value other than `null`.
* @param encoding The encoding if `chunk` is a string
- * @param callback Callback for when the stream is finished.
+ * @param cb Callback for when the stream is finished.
*/
- end(cb?: () => void): this;
- end(chunk: any, cb?: () => void): this;
end(chunk: any, encoding: BufferEncoding, cb?: () => void): this;
/**
* The `writable.cork()` method forces all written data to be buffered in memory.
@@ -1056,6 +1066,9 @@
writableHighWaterMark?: number | undefined;
writableCorked?: number | undefined;
}
+ interface DuplexToWebOptions {
+ type?: web.ReadableStreamType | undefined;
+ }
interface DuplexEventMap extends ReadableEventMap, WritableEventMap {}
/**
* Duplex streams are streams that implement both the `Readable` and `Writable` interfaces.
@@ -1109,7 +1122,7 @@
* A utility method for creating a web `ReadableStream` and `WritableStream` from a `Duplex`.
* @since v17.0.0
*/
- static toWeb(streamDuplex: NodeJS.ReadWriteStream): web.ReadableWritablePair;
+ static toWeb(streamDuplex: NodeJS.ReadWriteStream, options?: DuplexToWebOptions): web.ReadableWritablePair;
/**
* A utility method for creating a `Duplex` from a web `ReadableStream` and `WritableStream`.
* @since v17.0.0
@@ -1653,7 +1666,8 @@
* console.log(res); // prints 'HELLOWORLD'
* ```
*
- * See [`readable.compose(stream)`](https://nodejs.org/docs/latest-v25.x/api/stream.html#readablecomposestream-options) for `stream.compose` as operator.
+ * For convenience, the `readable.compose(stream)` method is available on
+ * `Readable` and `Duplex` streams as a wrapper for this function.
* @since v16.9.0
* @experimental
*/
--
Gitblit v1.9.3