/** * Loader for the unified ZipKit Wasm engine (Emscripten ES module). * * One module, all codecs: gzip/deflate/zlib (libdeflate), lz4, zstd (+ ultra), * brotli, snappy, lzma, bzip2, qoi (image), frame-delta (video). The ABI is * deliberately tiny — persistent buffers, one copy in and one copy out per * call, no allocation crossing the JS/Wasm boundary. * * The engine is the low-level escape hatch. Most users want the high-level * {@link import('./zipkit.js').ZipKit} class or the named codec helpers from * the package root; reach for `ZipKitEngine` only when you need raw codec * access without runtime dispatch. * * @example * ```ts * import { ZipKitEngine } from '@myrialabs/zipkit'; * const engine = await ZipKitEngine.load(); * const packed = engine.zstdCompress(bytes, 19); * ``` */ /** * The raw Wasm engine: every codec exposed as a synchronous * `Uint8Array -> Uint8Array` method. Construct it with the async * {@link ZipKitEngine.load} factory (Wasm instantiation is async), or call * {@link getEngine} for a process-wide lazily-instantiated singleton. */ export declare class ZipKitEngine { private m; private constructor(); /** Instantiate a fresh engine. Prefer {@link getEngine} to avoid reloading. */ static load(): Promise; private call; gzipCompress(d: Uint8Array, level?: number): Uint8Array; gzipDecompress(d: Uint8Array): Uint8Array; deflateCompress(d: Uint8Array, level?: number): Uint8Array; deflateDecompress(d: Uint8Array): Uint8Array; zlibCompress(d: Uint8Array, level?: number): Uint8Array; zlibDecompress(d: Uint8Array): Uint8Array; /** * CRC-32 (IEEE 802.3) of `d`, optionally continuing from a prior `seed`. * Returns the checksum directly — libdeflate's SIMD path, far faster than a * byte-at-a-time table. Used by the ZIP container. */ crc32(d: Uint8Array, seed?: number): number; lz4Compress(d: Uint8Array): Uint8Array; lz4Decompress(d: Uint8Array): Uint8Array; zstdCompress(d: Uint8Array, level?: number): Uint8Array; zstdDecompress(d: Uint8Array): Uint8Array; brotliCompress(d: Uint8Array, quality?: number): Uint8Array; brotliDecompress(d: Uint8Array): Uint8Array; snappyCompress(d: Uint8Array): Uint8Array; snappyDecompress(d: Uint8Array): Uint8Array; /** Max-ratio zstd (ultra + long-distance matching), up to level 22. */ zstdMaxCompress(d: Uint8Array, level?: number): Uint8Array; /** LZMA — highest general-purpose ratio. */ lzmaCompress(d: Uint8Array, level?: number): Uint8Array; lzmaDecompress(d: Uint8Array): Uint8Array; /** * Decode a raw LZMA2 stream (used by the 7z reader). `prop` is the single * LZMA2 dictionary-size property byte; `outSize` is the known unpacked size. */ lzma2Decompress(d: Uint8Array, prop: number, outSize: number): Uint8Array; /** xz — the standard `.xz` container around LZMA2 (full streaming codec). */ xzCompress(d: Uint8Array, level?: number): Uint8Array; xzDecompress(d: Uint8Array): Uint8Array; /** * Stage `dict` into the engine's auxiliary buffer for the next dictionary * call. Held until the next {@link setAux}, so set it immediately before * {@link zstdCompressDict}/{@link zstdDecompressDict} or {@link zstdTrainDict}. */ setAux(dict: Uint8Array): void; /** * Train a zstd dictionary of up to `dictCapacity` bytes from `samples`. Stage * the per-sample sizes (u32 LE) via {@link setAux} first; `samples` is the * concatenation of every sample. Returns the dictionary bytes (empty on * failure, e.g. too few samples). */ zstdTrainDict(samples: Uint8Array, nSamples: number, dictCapacity: number): Uint8Array; /** Compress `d` with the dictionary previously staged via {@link setAux}. */ zstdCompressDict(d: Uint8Array, level?: number): Uint8Array; /** Decompress `d` with the dictionary previously staged via {@link setAux}. */ zstdDecompressDict(d: Uint8Array): Uint8Array; /** bzip2 — Burrows–Wheeler transform. */ bzip2Compress(d: Uint8Array, level?: number): Uint8Array; bzip2Decompress(d: Uint8Array): Uint8Array; /** QOI — lossless image (raw RGB/RGBA pixels in, QOI bytes out). */ qoiEncode(pixels: Uint8Array, width: number, height: number, channels: number): Uint8Array; qoiDecode(d: Uint8Array): Uint8Array; /** * Frame-delta — lossless temporal predictor for video-like streams. Pair * `encode -> zstd/lz4` on the way in and `lz4/zstd -> decode` on the way out. */ frameDeltaEncode(d: Uint8Array, frameSize: number): Uint8Array; frameDeltaDecode(d: Uint8Array, frameSize: number): Uint8Array; } /** * Return the process-wide engine, instantiating the Wasm module on first call * and reusing it thereafter. This is what every high-level helper uses, so the * 1.4 MB module loads at most once per process. */ export declare function getEngine(): Promise; //# sourceMappingURL=engine.d.ts.map