1 |
|
2 | import { Readable, Writable } from 'stream';
|
3 | import { EmitterAugmentation1 } from './events';
|
4 | export type WriteCallback = (error: Error | null | undefined) => void;
|
5 | export interface IntermediateObjectReadable<T> extends Readable {
|
6 | read(size?: number): any & T;
|
7 | }
|
8 | export type ObjectReadable<T> = {
|
9 | read(size?: number): T;
|
10 | } & EmitterAugmentation1<'data', T> & IntermediateObjectReadable<T>;
|
11 | export interface IntermediateObjectWritable<T> extends Writable {
|
12 | _write(chunk: any & T, encoding: string, callback: Function): void;
|
13 | write(chunk: any & T, cb?: WriteCallback): boolean;
|
14 | write(chunk: any & T, encoding?: any, cb?: WriteCallback): boolean;
|
15 | setDefaultEncoding(encoding: string): this;
|
16 | end(): ReturnType<Writable['end']> extends Writable ? this : void;
|
17 | end(chunk: any & T, cb?: Function): ReturnType<Writable['end']> extends Writable ? this : void;
|
18 | end(chunk: any & T, encoding?: any, cb?: Function): ReturnType<Writable['end']> extends Writable ? this : void;
|
19 | }
|
20 | export interface ObjectWritable<T> extends IntermediateObjectWritable<T> {
|
21 | _write(chunk: T, encoding: string, callback: Function): void;
|
22 | write(chunk: T, cb?: Function): boolean;
|
23 | write(chunk: T, encoding?: any, cb?: Function): boolean;
|
24 | setDefaultEncoding(encoding: string): this;
|
25 | end(): ReturnType<Writable['end']> extends Writable ? this : void;
|
26 | end(chunk: T, cb?: Function): ReturnType<Writable['end']> extends Writable ? this : void;
|
27 | end(chunk: T, encoding?: any, cb?: Function): ReturnType<Writable['end']> extends Writable ? this : void;
|
28 | }
|