UNPKG

@lyleunderwood/streaming-zipper

Version:

Memory-efficient streaming ZIP creation with automatic backpressure control. Supports parallel reading + sequential writing for both Web Streams and Node.js streams with ZIP64 support.

42 lines 1.66 kB
/** * Stream adapters to convert between Web Streams and Node.js Streams * Uses readable-stream polyfill for universal compatibility */ import { Readable, Transform } from 'readable-stream'; export interface StreamAdapterOptions { highWaterMark?: number; objectMode?: boolean; } /** * Convert a Web ReadableStream to a Node.js Readable stream */ export declare class WebToNodeAdapter extends Readable { private webStream; private reader; private reading; private ended; constructor(webStream: ReadableStream<Uint8Array>, options?: StreamAdapterOptions); _read(): void; private readNext; _destroy(error: Error | null, callback: (error?: Error | null) => void): void; } /** * Convert a Node.js Readable stream to a Web ReadableStream * (Less commonly needed, but included for completeness) */ export declare function nodeToWebStream(nodeStream: NodeJS.ReadableStream): ReadableStream<Uint8Array>; /** * Utility to detect stream types */ export declare function isWebStream(stream: any): stream is ReadableStream<Uint8Array>; export declare function isNodeStream(stream: any): stream is NodeJS.ReadableStream; /** * Normalize any stream input to a Node.js Readable stream * This is the main function that ensures we always work with Node.js streams */ export declare function normalizeToNodeStream(input: ReadableStream<Uint8Array> | NodeJS.ReadableStream, options?: StreamAdapterOptions): NodeJS.ReadableStream; /** * Create a passthrough transform that can be used for monitoring/debugging */ export declare function createMonitorTransform(name: string): Transform; //# sourceMappingURL=stream-adapter.d.ts.map