UNPKG

1.44 kBTypeScriptView Raw
1/// <reference types="node" />
2/// <reference types="node" />
3import { Readable, ReadableOptions, Writable, WritableOptions } from 'stream';
4export declare class NullStream extends Writable {
5 _write(chunk: any, encoding: string, callback: () => void): void;
6}
7export interface ReadableStreamBufferOptions extends ReadableOptions {
8 chunkSize?: number;
9 allocSize?: number;
10 growSize?: number;
11}
12export declare class ReadableStreamBuffer extends Readable {
13 protected buffer: Buffer;
14 protected _size: number;
15 protected _stopped: boolean;
16 protected chunkSize: number;
17 protected growSize: number;
18 constructor(opts?: ReadableStreamBufferOptions);
19 get size(): number;
20 get stopped(): boolean;
21 _read(): void;
22 feed(data: Buffer | string, encoding?: BufferEncoding): void;
23 stop(): void;
24 protected _send(): void;
25}
26export interface WritableStreamBufferOptions extends WritableOptions {
27 allocSize?: number;
28 growSize?: number;
29}
30export declare class WritableStreamBuffer extends Writable {
31 protected buffer: Buffer;
32 protected _size: number;
33 protected growSize: number;
34 constructor(opts?: WritableStreamBufferOptions);
35 get size(): number;
36 _write(chunk: any, encoding: string, callback: () => void): void;
37 consume(bytes?: number): Buffer;
38}
39export declare function growBufferForAppendedData(buf: Buffer, actualsize: number, appendsize: number): Buffer;