@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.51 kB
TypeScript
/**
* Stream utilities for handling Web Streams and Node.js streams
*/
/**
* Converts a Node.js readable stream to a Web ReadableStream
*/
export declare function nodeStreamToWebStream(nodeStream: NodeJS.ReadableStream): ReadableStream<Uint8Array>;
/**
* Creates a PassThrough transform stream that forwards data
*/
export declare function createPassThroughStream(): TransformStream<Uint8Array, Uint8Array>;
/**
* Creates a transform stream that counts bytes
*/
export declare function createByteCounterStream(): {
stream: TransformStream<Uint8Array, Uint8Array>;
getByteCount: () => number;
};
/**
* Reads all data from a stream into a Uint8Array
*/
export declare function streamToUint8Array(stream: ReadableStream<Uint8Array>): Promise<Uint8Array>;
/**
* Creates a readable stream from a Uint8Array
*/
export declare function uint8ArrayToStream(data: Uint8Array): ReadableStream<Uint8Array>;
/**
* Tees a readable stream into multiple streams
*/
export declare function teeStream<T>(stream: ReadableStream<T>, count: number): ReadableStream<T>[];
/**
* Creates a writable stream that collects all written data
*/
export declare function createCollectorStream(): {
writable: WritableStream<Uint8Array>;
getData: () => Uint8Array;
};
/**
* Pipes a readable stream to a writable stream with error handling
*/
export declare function pipeStreamWithErrorHandling<T>(readable: ReadableStream<T>, writable: WritableStream<T>): Promise<void>;
//# sourceMappingURL=stream-utils.d.ts.map