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