1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | import { 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(
|
41 | chunk: any & T,
|
42 | cb?: Function
|
43 | ): ReturnType<Writable['end']> extends Writable ? this : void;
|
44 | end(
|
45 | chunk: any & T,
|
46 | encoding?: any,
|
47 | cb?: Function
|
48 | ): ReturnType<Writable['end']> extends Writable ? this : void;
|
49 | }
|
50 |
|
51 | export interface ObjectWritable<T> extends IntermediateObjectWritable<T> {
|
52 | _write(chunk: T, encoding: string, callback: Function): void;
|
53 | write(chunk: T, cb?: Function): boolean;
|
54 | write(chunk: T, encoding?: any, cb?: Function): boolean;
|
55 | setDefaultEncoding(encoding: string): this;
|
56 | end(): ReturnType<Writable['end']> extends Writable ? this : void;
|
57 | end(
|
58 | chunk: T,
|
59 | cb?: Function
|
60 | ): ReturnType<Writable['end']> extends Writable ? this : void;
|
61 | end(
|
62 | chunk: T,
|
63 | encoding?: any,
|
64 | cb?: Function
|
65 | ): ReturnType<Writable['end']> extends Writable ? this : void;
|
66 | }
|