1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | import { Stream } from 'stream';
|
9 |
|
10 | type Appendable = NodeJS.ReadableStream | NodeJS.WritableStream | Buffer | string | NextFunction;
|
11 | type NextFunction = (next: (stream: Appendable) => any) => any;
|
12 |
|
13 | interface Options {
|
14 | maxDataSize?: number | undefined;
|
15 | pauseStreams?: boolean | undefined;
|
16 | }
|
17 |
|
18 | declare class CombinedStream extends Stream implements Options {
|
19 | readonly writable: boolean;
|
20 | readonly readable: boolean;
|
21 | readonly dataSize: number;
|
22 | maxDataSize: number;
|
23 | pauseStreams: boolean;
|
24 | append(stream: Appendable): this;
|
25 | write(data: any): void;
|
26 | pause(): void;
|
27 | resume(): void;
|
28 | end(): void;
|
29 | destroy(): void;
|
30 |
|
31 |
|
32 | _released: boolean;
|
33 |
|
34 | _streams: Array<Stream | Buffer | string>;
|
35 | _currentStream: Stream | Buffer | string | null;
|
36 | _getNext(): void;
|
37 | _pipeNext(): void;
|
38 | _handleErrors(stream: NodeJS.EventEmitter): void;
|
39 | _reset(): void;
|
40 | _checkDataSize(): void;
|
41 | _updateDataSize(): void;
|
42 | _emitError(error: Error): void;
|
43 |
|
44 |
|
45 | on(event: 'close' | 'end' | 'resume' | 'pause', cb: () => void): this;
|
46 | on(event: 'error', cb: (err: Error) => void): this;
|
47 | on(event: 'data', cb: (data: any) => void): this;
|
48 | once(event: 'close' | 'end' | 'resume' | 'pause', cb: () => void): this;
|
49 | once(event: 'error', cb: (err: Error) => void): this;
|
50 | once(event: 'data', cb: (data: any) => void): this;
|
51 |
|
52 | static create(options?: Options): CombinedStream;
|
53 | static isStreamLike(stream: any): stream is Stream;
|
54 | }
|
55 |
|
56 | export = CombinedStream;
|