@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.
56 lines • 1.69 kB
TypeScript
/**
* Core StreamingZipWriter class for creating ZIP files with parallel reading + sequential writing
*/
import { ZipEntry, FastPathStoreEntry, FastPathDeflateEntry } from './zip-format.js';
export interface StreamingZipWriterOptions {
compression?: 'store' | 'deflate';
level?: number;
comment?: string;
maxBufferSize?: number;
maxConcurrentReads?: number;
}
export declare class StreamingZipWriter {
private options;
private parallelReader;
private writeQueue;
private outputController;
private outputStream;
private finalized;
private writeLoopRunning;
private writeLoopPromise;
private fastPathEntries;
constructor(options?: StreamingZipWriterOptions);
/**
* Get the output stream for the ZIP file
*/
getOutputStream(): ReadableStream<Uint8Array>;
/**
* Add an entry to the ZIP file with automatic fast-path detection
*/
addEntry(entry: ZipEntry): void;
/**
* Add a fast-path entry for immediate streaming
*/
addFastPathEntry(entry: FastPathStoreEntry | FastPathDeflateEntry): void;
/**
* Finalize the ZIP file (no more entries can be added)
*/
finalize(): Promise<void>;
/**
* Start the write loop if not already running
*/
private startWriteLoopIfNeeded;
/**
* Main write loop - writes entries as they become ready (both buffered and fast-path)
*/
private runWriteLoop;
/**
* Write the end of central directory records
*/
private writeEndOfCentralDirectory;
/**
* Write data to the output stream
*/
private writeToOutput;
}
//# sourceMappingURL=streaming-zip-writer.d.ts.map