UNPKG

1.2 kBTypeScriptView Raw
1// Duplicates of interface in lib.dom.ts.
2// Duplicated here rather than referencing lib.dom.ts because doing so causes lib.dom.ts to be loaded for "test-all"
3// Which in turn causes tests to pass that shouldn't pass.
4//
5// This interface is not, and should not be, exported.
6interface Blob {
7 readonly size: number;
8 readonly type: string;
9 arrayBuffer(): Promise<ArrayBuffer>;
10 slice(start?: number, end?: number, contentType?: string): Blob;
11 stream(): NodeJS.ReadableStream;
12 text(): Promise<string>;
13}
14declare module 'stream/consumers' {
15 import { Readable } from 'node:stream';
16 function buffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<Buffer>;
17 function text(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<string>;
18 function arrayBuffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<ArrayBuffer>;
19 function blob(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<Blob>;
20 function json(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<unknown>;
21}
22declare module 'node:stream/consumers' {
23 export * from 'stream/consumers';
24}