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/consumers.d.ts | 86 ++++++++++++++++++++++++++++++++++++++++--
1 files changed, 81 insertions(+), 5 deletions(-)
diff --git a/node_modules/@types/node/stream/consumers.d.ts b/node_modules/@types/node/stream/consumers.d.ts
index 97f260d..27a474c 100644
--- a/node_modules/@types/node/stream/consumers.d.ts
+++ b/node_modules/@types/node/stream/consumers.d.ts
@@ -1,33 +1,109 @@
-/**
- * The utility consumer functions provide common options for consuming
- * streams.
- * @since v16.7.0
- */
declare module "node:stream/consumers" {
import { Blob, NonSharedBuffer } from "node:buffer";
import { ReadableStream } from "node:stream/web";
/**
+ * ```js
+ * import { arrayBuffer } from 'node:stream/consumers';
+ * import { Readable } from 'node:stream';
+ * import { TextEncoder } from 'node:util';
+ *
+ * const encoder = new TextEncoder();
+ * const dataArray = encoder.encode('hello world from consumers!');
+ *
+ * const readable = Readable.from(dataArray);
+ * const data = await arrayBuffer(readable);
+ * console.log(`from readable: ${data.byteLength}`);
+ * // Prints: from readable: 76
+ * ```
* @since v16.7.0
* @returns Fulfills with an `ArrayBuffer` containing the full contents of the stream.
*/
function arrayBuffer(stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<ArrayBuffer>;
/**
+ * ```js
+ * import { blob } from 'node:stream/consumers';
+ *
+ * const dataBlob = new Blob(['hello world from consumers!']);
+ *
+ * const readable = dataBlob.stream();
+ * const data = await blob(readable);
+ * console.log(`from readable: ${data.size}`);
+ * // Prints: from readable: 27
+ * ```
* @since v16.7.0
* @returns Fulfills with a `Blob` containing the full contents of the stream.
*/
function blob(stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<Blob>;
/**
+ * ```js
+ * import { buffer } from 'node:stream/consumers';
+ * import { Readable } from 'node:stream';
+ * import { Buffer } from 'node:buffer';
+ *
+ * const dataBuffer = Buffer.from('hello world from consumers!');
+ *
+ * const readable = Readable.from(dataBuffer);
+ * const data = await buffer(readable);
+ * console.log(`from readable: ${data.length}`);
+ * // Prints: from readable: 27
+ * ```
* @since v16.7.0
* @returns Fulfills with a `Buffer` containing the full contents of the stream.
*/
function buffer(stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<NonSharedBuffer>;
/**
+ * ```js
+ * import { bytes } from 'node:stream/consumers';
+ * import { Readable } from 'node:stream';
+ * import { Buffer } from 'node:buffer';
+ *
+ * const dataBuffer = Buffer.from('hello world from consumers!');
+ *
+ * const readable = Readable.from(dataBuffer);
+ * const data = await bytes(readable);
+ * console.log(`from readable: ${data.length}`);
+ * // Prints: from readable: 27
+ * ```
+ * @since v25.6.0
+ * @returns Fulfills with a `Uint8Array` containing the full contents of the stream.
+ */
+ function bytes(
+ stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>,
+ ): Promise<NodeJS.NonSharedUint8Array>;
+ /**
+ * ```js
+ * import { json } from 'node:stream/consumers';
+ * import { Readable } from 'node:stream';
+ *
+ * const items = Array.from(
+ * {
+ * length: 100,
+ * },
+ * () => ({
+ * message: 'hello world from consumers!',
+ * }),
+ * );
+ *
+ * const readable = Readable.from(JSON.stringify(items));
+ * const data = await json(readable);
+ * console.log(`from readable: ${data.length}`);
+ * // Prints: from readable: 100
+ * ```
* @since v16.7.0
* @returns Fulfills with the contents of the stream parsed as a
* UTF-8 encoded string that is then passed through `JSON.parse()`.
*/
function json(stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<unknown>;
/**
+ * ```js
+ * import { text } from 'node:stream/consumers';
+ * import { Readable } from 'node:stream';
+ *
+ * const readable = Readable.from('Hello world from consumers!');
+ * const data = await text(readable);
+ * console.log(`from readable: ${data.length}`);
+ * // Prints: from readable: 27
+ * ```
* @since v16.7.0
* @returns Fulfills with the contents of the stream parsed as a UTF-8 encoded string.
*/
--
Gitblit v1.9.3