/**
 * Node.js Stream shim
 * Basic Readable and Writable stream implementations
 */
import { EventEmitter } from './events';
export declare class Readable extends EventEmitter {
    private _buffer;
    private _ended;
    private _flowing;
    private _endEmitted;
    readable: boolean;
    readableEnded: boolean;
    readableFlowing: boolean | null;
    constructor();
    private _addListenerInternal;
    on(event: string | symbol, listener: (...args: unknown[]) => void): this;
    addListener(event: string | symbol, listener: (...args: unknown[]) => void): this;
    push(chunk: Uint8Array | string | null): boolean;
    private _flushBuffer;
    read(size?: number): Buffer | null;
    resume(): this;
    pause(): this;
    pipe<T extends Writable>(destination: T): T;
    unpipe(destination?: Writable): this;
    setEncoding(encoding: string): this;
    destroy(error?: Error): this;
    /**
     * Creates a Readable stream from an iterable or async iterable
     * @param iterable - An iterable or async iterable to create the stream from
     * @param options - Optional stream options
     */
    static from(iterable: Iterable<unknown> | AsyncIterable<unknown>, options?: {
        objectMode?: boolean;
        highWaterMark?: number;
    }): Readable;
}
export declare class Writable extends EventEmitter {
    private _chunks;
    private _ended;
    writable: boolean;
    writableEnded: boolean;
    writableFinished: boolean;
    constructor();
    write(chunk: Uint8Array | string, encodingOrCallback?: string | ((error?: Error | null) => void), callback?: (error?: Error | null) => void): boolean;
    end(chunkOrCallback?: Uint8Array | string | (() => void), encodingOrCallback?: string | (() => void), callback?: () => void): this;
    getBuffer(): Buffer;
    getBufferAsString(encoding?: BufferEncoding): string;
    destroy(error?: Error): this;
    cork(): void;
    uncork(): void;
    setDefaultEncoding(encoding: string): this;
}
export declare class Duplex extends Readable {
    private _writeChunks;
    private _writeEnded;
    writable: boolean;
    writableEnded: boolean;
    writableFinished: boolean;
    write(chunk: Buffer | string, encodingOrCallback?: string | ((error?: Error | null) => void), callback?: (error?: Error | null) => void): boolean;
    end(chunkOrCallback?: Buffer | string | (() => void), encodingOrCallback?: string | (() => void), callback?: () => void): this;
}
export declare class PassThrough extends Duplex {
    constructor();
    write(chunk: Buffer | string, encodingOrCallback?: string | ((error?: Error | null) => void), callback?: (error?: Error | null) => void): boolean;
}
export declare class Transform extends Duplex {
    constructor();
    _transform(chunk: Buffer, encoding: string, callback: (error?: Error | null, data?: Buffer) => void): void;
    _flush(callback: (error?: Error | null, data?: Buffer) => void): void;
    write(chunk: Buffer | string, encodingOrCallback?: string | ((error?: Error | null) => void), callback?: (error?: Error | null) => void): boolean;
    end(chunkOrCallback?: Buffer | string | (() => void), encodingOrCallback?: string | (() => void), callback?: () => void): this;
}
export declare class Stream extends EventEmitter {
    pipe<T extends Writable>(destination: T): T;
}
export declare const promises: {
    pipeline: (...streams: unknown[]) => Promise<void>;
    finished: (stream: unknown) => Promise<void>;
};
export declare function pipeline(...args: unknown[]): unknown;
export declare function finished(stream: unknown, callback: (err?: Error) => void): () => void;
declare global {
    interface Window {
        Buffer: typeof Buffer;
    }
}
declare class BufferPolyfill extends Uint8Array {
    static readonly BYTES_PER_ELEMENT = 1;
    static from(arrayLike: ArrayLike<number>): BufferPolyfill;
    static from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number, thisArg?: unknown): BufferPolyfill;
    static from(data: string, encoding?: string): BufferPolyfill;
    static from(data: ArrayBuffer | Uint8Array): BufferPolyfill;
    static from(data: Iterable<number>): BufferPolyfill;
    static alloc(size: number, fill?: number): BufferPolyfill;
    static allocUnsafe(size: number): BufferPolyfill;
    static allocUnsafeSlow(size: number): BufferPolyfill;
    static concat(buffers: (Uint8Array | BufferPolyfill)[]): BufferPolyfill;
    static isBuffer(obj: unknown): obj is BufferPolyfill;
    static isEncoding(encoding: string): boolean;
    static byteLength(string: string, encoding?: string): number;
    toString(encoding?: BufferEncoding): string;
    slice(start?: number, end?: number): BufferPolyfill;
    subarray(start?: number, end?: number): BufferPolyfill;
    write(string: string, offset?: number): number;
    copy(target: BufferPolyfill, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
    compare(otherBuffer: Uint8Array): number;
    equals(otherBuffer: Uint8Array): boolean;
    toJSON(): {
        type: string;
        data: number[];
    };
    hasOwnProperty(prop: PropertyKey): boolean;
    readUInt8(offset: number): number;
    readUInt16BE(offset: number): number;
    readUInt16LE(offset: number): number;
    readUInt32BE(offset: number): number;
    readUInt32LE(offset: number): number;
    writeUInt8(value: number, offset: number): number;
    writeUInt16BE(value: number, offset: number): number;
    writeUInt16LE(value: number, offset: number): number;
    writeUInt32BE(value: number, offset: number): number;
    writeUInt32LE(value: number, offset: number): number;
    readUint8(offset: number): number;
    readUint16BE(offset: number): number;
    readUint16LE(offset: number): number;
    readUint32BE(offset: number): number;
    readUint32LE(offset: number): number;
    writeUint8(value: number, offset: number): number;
    writeUint16BE(value: number, offset: number): number;
    writeUint16LE(value: number, offset: number): number;
    writeUint32BE(value: number, offset: number): number;
    writeUint32LE(value: number, offset: number): number;
    readInt8(offset: number): number;
    readInt16BE(offset: number): number;
    readInt16LE(offset: number): number;
    readInt32BE(offset: number): number;
    readInt32LE(offset: number): number;
    writeInt8(value: number, offset: number): number;
    writeInt16BE(value: number, offset: number): number;
    writeInt16LE(value: number, offset: number): number;
    writeInt32BE(value: number, offset: number): number;
    writeInt32LE(value: number, offset: number): number;
    readBigUInt64LE(offset: number): bigint;
    readBigUInt64BE(offset: number): bigint;
    readBigInt64LE(offset: number): bigint;
    readBigInt64BE(offset: number): bigint;
    writeBigUInt64LE(value: bigint, offset: number): number;
    writeBigUInt64BE(value: bigint, offset: number): number;
    writeBigInt64LE(value: bigint, offset: number): number;
    writeBigInt64BE(value: bigint, offset: number): number;
    readBigUint64LE(offset: number): bigint;
    readBigUint64BE(offset: number): bigint;
    writeBigUint64LE(value: bigint, offset: number): number;
    writeBigUint64BE(value: bigint, offset: number): number;
    readFloatLE(offset: number): number;
    readFloatBE(offset: number): number;
    readDoubleLE(offset: number): number;
    readDoubleBE(offset: number): number;
    writeFloatLE(value: number, offset: number): number;
    writeFloatBE(value: number, offset: number): number;
    writeDoubleLE(value: number, offset: number): number;
    writeDoubleBE(value: number, offset: number): number;
    readUIntLE(offset: number, byteLength: number): number;
    readUintLE(offset: number, byteLength: number): number;
    readUIntBE(offset: number, byteLength: number): number;
    readUintBE(offset: number, byteLength: number): number;
    readIntLE(offset: number, byteLength: number): number;
    readIntBE(offset: number, byteLength: number): number;
    writeUIntLE(value: number, offset: number, byteLength: number): number;
    writeUintLE(value: number, offset: number, byteLength: number): number;
    writeUIntBE(value: number, offset: number, byteLength: number): number;
    writeUintBE(value: number, offset: number, byteLength: number): number;
    writeIntLE(value: number, offset: number, byteLength: number): number;
    writeIntBE(value: number, offset: number, byteLength: number): number;
    swap16(): this;
    swap32(): this;
    swap64(): this;
}
export { BufferPolyfill as Buffer };
export default Stream;
//# sourceMappingURL=stream.d.ts.map