1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | import * as stream from 'stream';
|
8 |
|
9 | export = from2;
|
10 |
|
11 | declare function from2(read: from2.ReadInput): NodeJS.ReadableStream;
|
12 | declare function from2(opts: from2.ObjectModeOptions, read: from2.ReadObjectInput): NodeJS.ReadableStream;
|
13 | declare function from2(opts: from2.Options, read: from2.ReadInput): NodeJS.ReadableStream;
|
14 |
|
15 | declare namespace from2 {
|
16 | function obj(read: ReadObjectInput): NodeJS.ReadableStream;
|
17 | function obj(opts: { objectMode?: true | undefined } & stream.ReadableOptions, read: ReadObjectInput): NodeJS.ReadableStream;
|
18 |
|
19 | function ctor(opts?: Options): From2Ctor<ReadInput>;
|
20 | function ctor(opts: ObjectModeOptions): From2Ctor<ReadObjectInput>;
|
21 |
|
22 | type ObjectModeOptions = { objectMode: true } & stream.ReadableOptions;
|
23 | type Options = { objectMode?: false | undefined } & stream.ReadableOptions;
|
24 |
|
25 | type From2Ctor<R extends ReadInput | ReadObjectInput> = new(read: R) => NodeJS.ReadableStream;
|
26 |
|
27 | type ReadObjectInput = ReadCallback<NextObjectCallback> | any[];
|
28 | type ReadInput = ReadCallback<NextCallback> | Chunk[];
|
29 | type ReadCallback<N extends NextCallback | NextObjectCallback> = (size: number, next: N) => void;
|
30 | type NextCallback = (err: any | undefined, chunk: Chunk) => void;
|
31 | type NextObjectCallback = (err: any | undefined, chunk: any) => void;
|
32 | type Chunk = string | Buffer | Uint8Array | null;
|
33 | }
|