@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.
85 lines • 2.04 kB
TypeScript
/**
* Simplified EntryBuffer using Node.js streams - focus on getting basic functionality working
*/
import { ZipEntry } from './zip-format.js';
import { CompressionMethod } from './compression-streams.js';
export declare enum EntryState {
PENDING = "pending",
READY = "ready",
WRITING = "writing",
COMPLETED = "completed",
ERROR = "error"
}
export interface EntryMetadata {
crc32: number;
compressedSize: number;
uncompressedSize: number;
localHeaderOffset: number;
compressionMethod: CompressionMethod;
}
export interface BufferedChunk {
data: Buffer;
offset: number;
}
/**
* Simplified EntryBuffer using Node.js streams
*/
export declare class EntryBufferSimple {
readonly entry: ZipEntry;
readonly index: number;
readonly compressionMethod: CompressionMethod;
private state;
private chunks;
private metadata;
private error;
constructor(entry: ZipEntry, index: number, compressionMethod?: CompressionMethod);
/**
* Process the entry and collect all data
*/
process(): Promise<void>;
/**
* Get current entry state
*/
getState(): EntryState;
/**
* Check if entry is ready to be written
*/
isReady(): boolean;
/**
* Read the next chunk from the buffer
*/
readChunk(): BufferedChunk | null;
/**
* Get total buffered size
*/
getBufferedSize(): number;
/**
* Get entry metadata
*/
getMetadata(): EntryMetadata;
/**
* Set the local header offset
*/
setLocalHeaderOffset(offset: number): void;
/**
* Mark entry as being written
*/
startWriting(): void;
/**
* Mark entry as completed
*/
markCompleted(): void;
/**
* Get total uncompressed size
*/
getUncompressedSize(): number;
/**
* Get total compressed size
*/
getCompressedSize(): number;
/**
* Get CRC32 checksum
*/
getCRC32(): number;
}
//# sourceMappingURL=entry-buffer-simple.d.ts.map