1 | # Installation
|
2 | > `npm install --save @types/combined-stream`
|
3 |
|
4 | # Summary
|
5 | This package contains type definitions for combined-stream (https://github.com/felixge/node-combined-stream).
|
6 |
|
7 | # Details
|
8 | Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/combined-stream.
|
9 | ## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/combined-stream/index.d.ts)
|
10 | ````ts
|
11 | // Type definitions for combined-stream 1.0
|
12 | // Project: https://github.com/felixge/node-combined-stream
|
13 | // Definitions by: Felix Geisendörfer <https://github.com/felixge>, Tomek Łaziuk <https://github.com/tlaziuk>, Kon Pik <https://github.com/konpikwastaken>
|
14 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
15 |
|
16 | /// <reference types="node" />
|
17 |
|
18 | import { Stream } from "stream";
|
19 |
|
20 | type Appendable = NodeJS.ReadableStream | NodeJS.WritableStream | Buffer | string | NextFunction;
|
21 | type NextFunction = (next: (stream: Appendable) => any) => any;
|
22 |
|
23 | interface Options {
|
24 | maxDataSize?: number | undefined;
|
25 | pauseStreams?: boolean | undefined;
|
26 | }
|
27 |
|
28 | declare class CombinedStream extends Stream implements Options {
|
29 | readonly writable: boolean;
|
30 | readonly readable: boolean;
|
31 | readonly dataSize: number;
|
32 | maxDataSize: number;
|
33 | pauseStreams: boolean;
|
34 | append(stream: Appendable): this;
|
35 | write(data: any): void;
|
36 | pause(): void;
|
37 | resume(): void;
|
38 | end(): void;
|
39 | destroy(): void;
|
40 |
|
41 | // private properties
|
42 | _released: boolean;
|
43 | // @TODO it should be a type of Array<'delayed-stream' instance | Buffer | string>
|
44 | _streams: Array<Stream | Buffer | string>;
|
45 | _currentStream: Stream | Buffer | string | null;
|
46 | _getNext(): void;
|
47 | _pipeNext(): void;
|
48 | _handleErrors(stream: NodeJS.EventEmitter): void;
|
49 | _reset(): void;
|
50 | _checkDataSize(): void;
|
51 | _updateDataSize(): void;
|
52 | _emitError(error: Error): void;
|
53 |
|
54 | // events
|
55 | on(event: "close" | "end" | "resume" | "pause", cb: () => void): this;
|
56 | on(event: "error", cb: (err: Error) => void): this;
|
57 | on(event: "data", cb: (data: any) => void): this;
|
58 | once(event: "close" | "end" | "resume" | "pause", cb: () => void): this;
|
59 | once(event: "error", cb: (err: Error) => void): this;
|
60 | once(event: "data", cb: (data: any) => void): this;
|
61 |
|
62 | static create(options?: Options): CombinedStream;
|
63 | static isStreamLike(stream: any): stream is Stream;
|
64 | }
|
65 |
|
66 | export = CombinedStream;
|
67 |
|
68 | ````
|
69 |
|
70 | ### Additional Details
|
71 | * Last updated: Mon, 04 Sep 2023 15:41:01 GMT
|
72 | * Dependencies: [@types/node](https://npmjs.com/package/@types/node)
|
73 | * Global values: none
|
74 |
|
75 | # Credits
|
76 | These definitions were written by [Felix Geisendörfer](https://github.com/felixge), [Tomek Łaziuk](https://github.com/tlaziuk), and [Kon Pik](https://github.com/konpikwastaken).
|
77 |
|
\ | No newline at end of file |