-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.d.ts
43 lines (33 loc) · 1.12 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import {
ReadableOptions as ReadableNodeStreamOptions,
WritableOptions as WritableNodeStreamOptions,
} from 'node:stream';
export interface ReadableStreamOptions extends Omit<ReadableNodeStreamOptions, 'read'> {
/**
The amount of data to stream in bytes.
Set it to `Infinity` to make it produce data until you manually destroy the stream.
@default 0
*/
readonly size?: number;
}
export interface WritableStreamOptions extends Omit<WritableNodeStreamOptions, 'write'> {}
/**
Create a readable Node.js stream that produces no data (or optionally blank data).
@example
```
import stream from 'node:stream';
import {readableNoopStream} from 'noop-stream';
stream.pipeline(readableNoopStream({size: 10}), process.stdout);
```
*/
export function readableNoopStream(options?: ReadableStreamOptions): NodeJS.ReadableStream;
/**
Create a writable Node.js stream that discards received data.
@example
```
import stream from 'node:stream';
import {writableNoopStream} from 'noop-stream';
stream.pipeline(process.stdin, writableNoopStream());
```
*/
export function writableNoopStream(options?: WritableStreamOptions): NodeJS.WritableStream;