1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | import { Duplex, Readable, Writable } from 'stream';
|
19 | import { EmitterAugmentation1 } from './events';
|
20 |
|
21 |
|
22 |
|
23 | export type WriteCallback = (error: Error | null | undefined) => void;
|
24 |
|
25 | export interface IntermediateObjectReadable<T> extends Readable {
|
26 | read(size?: number): any & T;
|
27 | }
|
28 |
|
29 | export type ObjectReadable<T> = {
|
30 | read(size?: number): T;
|
31 | } & EmitterAugmentation1<'data', T> &
|
32 | IntermediateObjectReadable<T>;
|
33 |
|
34 | export interface IntermediateObjectWritable<T> extends Writable {
|
35 | _write(chunk: any & T, encoding: string, callback: Function): void;
|
36 | write(chunk: any & T, cb?: WriteCallback): boolean;
|
37 | write(chunk: any & T, encoding?: any, cb?: WriteCallback): boolean;
|
38 | setDefaultEncoding(encoding: string): this;
|
39 | end(): ReturnType<Writable['end']> extends Writable ? this : void;
|
40 | end(chunk: any & T, cb?: Function): ReturnType<Writable['end']> extends Writable ? this : void;
|
41 | end(chunk: any & T, encoding?: any, cb?: Function): ReturnType<Writable['end']> extends Writable ? this : void;
|
42 | }
|
43 |
|
44 | export interface ObjectWritable<T> extends IntermediateObjectWritable<T> {
|
45 | _write(chunk: T, encoding: string, callback: Function): void;
|
46 | write(chunk: T, cb?: Function): boolean;
|
47 | write(chunk: T, encoding?: any, cb?: Function): boolean;
|
48 | setDefaultEncoding(encoding: string): this;
|
49 | end(): ReturnType<Writable['end']> extends Writable ? this : void;
|
50 | end(chunk: T, cb?: Function): ReturnType<Writable['end']> extends Writable ? this : void;
|
51 | end(chunk: T, encoding?: any, cb?: Function): ReturnType<Writable['end']> extends Writable ? this : void;
|
52 | }
|