import * as Stream from 'stream'; import * as Events from 'events'; export declare class Readable extends Events.EventEmitter { constructor(); } export declare class Writable extends Events.EventEmitter { constructor(); write(b: any, encoding?: BufferEncoding, cb?: () => void): boolean; end(): void; } export declare class BufferWritable extends Writable { _bufs: Buffer[]; _buf: Buffer; constructor(); write(b: any, encoding?: BufferEncoding, cb?: () => void): boolean; end(): void; } export declare class BufferReadable extends Stream.Readable { _b: Buffer; constructor(b: Buffer); _read(): void; } export declare class MultiBufferReadable extends Stream.Readable { constructor(); _read(): void; more(buf: Buffer): void; end(): void; } declare enum ReadState { Start = 0, ObjectPropertyStart = 1, ObjectPropertyEnd = 2, ValueStart = 3, ValueEnd = 4, InName = 5, InNameBackslash = 6, NeedColon = 7, InNumber = 8, InString = 9, InStringBackslash = 10, InTrue = 11, InFalse = 12, InNull = 13, InUndefined = 14, Error = 15, Ended = 16 } declare enum TokType { TTNone = 0, TTArray = 1, TTObject = 2, TTName = 3, TTString = 4, TTNumber = 5, TTTrue = 6, TTFalse = 7, TTNull = 8, TTUndefined = 9 } interface Token { tt: TokType; v: any; emit?: string; } export interface JSONStreamOptions { maxTokenSize?: number; outBufferSize?: number; encoding?: BufferEncoding; syncChunkSize?: number; } export declare class JSONStreamReader extends Events.EventEmitter { _s: Readable; _charCount: number; _lineCount: number; _state: ReadState; _tok: Buffer; _tokLen: number; _stack: Token[]; _result: any; _incr: any; _options: JSONStreamOptions; _chunks: Buffer[]; _chunkCur: number; _chunkIndex: number; _chunkScheduled: boolean; _ended: boolean; _closed: boolean; constructor(options?: JSONStreamOptions); start(s: Readable): void; finish(): void; emitIncremental(name: string): void; pushToken(tok: Token): void; private badJSON; private startTok; private addToTok; private consumeTok; private produceValue; private produceValidatedValue; private onData; private scheduleNext; private nextChunk; private onClose; private doClose; private onError; private onEnd; private doEnd; } interface ObjectWriteState { o: any; keys: string[]; index: number; } export declare class JSONStreamWriter extends Events.EventEmitter { _s: Writable; _stack: ObjectWriteState[]; _chunk: Buffer; _chunkLen: number; _options: JSONStreamOptions; _bDone: boolean; constructor(options?: JSONStreamOptions); start(o: any, s: Writable): void; addToChunk(s: string): boolean; drainChunk(): boolean; onDrain(): void; onError(e: Error): void; onClose(): void; onFinish(): void; } export {};