/** * ZipKit — the high-level, synchronous API with runtime-adaptive dispatch. * * Goal: keep the public API small while still taking the best path available: * • gzip/deflate — balanced/speed always use native Bun zlib when available; * ratio mode forces libdeflate for denser output. * • zlib — uses the libdeflate engine for standard zlib streams. * • zstd — where Bun ships native libzstd (the speed ceiling), dispatch to * native. In the browser / Node, fall back to the ZipKit Wasm engine. * • lz4/snappy/brotli/lzma/bzip2/qoi/frame-delta — no native competitor * exists anywhere, so always use the ZipKit engine. * * Net effect: the default is practical and fast, while `mode: 'ratio'` makes * density explicit without exposing a maze of options. * * Methods here are synchronous because the engine is already loaded — construct * an instance with `await ZipKit.load()`. For the async, lazy-loading helpers, * import the named codec functions from the package root instead. */ import { ZipKitEngine } from './engine.js'; import type { CompressOptions } from './types.js'; type SyncCompressOptions = number | CompressOptions | undefined; /** The codec used to compress the frame-delta residual (see {@link ZipKit.encodeFrames}). */ export type FrameCodec = 'zstd' | 'lz4'; export declare class ZipKit { /** The underlying raw Wasm engine, for codecs not surfaced as methods here. */ readonly engine: ZipKitEngine; /** * Which path zstd dispatches to: native (`'bun'`) or the Wasm engine * (`'wasm'`). */ readonly runtime: 'bun' | 'wasm'; private constructor(); /** Instantiate the engine and return a ready-to-use, synchronous instance. */ static load(): Promise; gzip(d: Uint8Array, levelOrOpts?: SyncCompressOptions): Uint8Array; gunzip(d: Uint8Array): Uint8Array; deflate(d: Uint8Array, levelOrOpts?: SyncCompressOptions): Uint8Array; inflate(d: Uint8Array): Uint8Array; zlib(d: Uint8Array, levelOrOpts?: SyncCompressOptions): Uint8Array; unzlib(d: Uint8Array): Uint8Array; zstd(d: Uint8Array, levelOrOpts?: SyncCompressOptions): Uint8Array; unzstd(d: Uint8Array): Uint8Array; lz4(d: Uint8Array): Uint8Array; unlz4(d: Uint8Array): Uint8Array; snappy(d: Uint8Array): Uint8Array; unsnappy(d: Uint8Array): Uint8Array; brotli(d: Uint8Array, levelOrOpts?: SyncCompressOptions): Uint8Array; unbrotli(d: Uint8Array): Uint8Array; lzma(d: Uint8Array, levelOrOpts?: SyncCompressOptions): Uint8Array; unlzma(d: Uint8Array): Uint8Array; bzip2(d: Uint8Array, levelOrOpts?: SyncCompressOptions): Uint8Array; unbzip2(d: Uint8Array): Uint8Array; encodeImage(pixels: Uint8Array, w: number, h: number, channels: 3 | 4): Uint8Array; decodeImage(d: Uint8Array): Uint8Array; encodeFrames(frames: Uint8Array, frameSize: number, codec?: FrameCodec): Uint8Array; decodeFrames(d: Uint8Array, frameSize: number, codec?: FrameCodec): Uint8Array; /** * Try the max-ratio codecs (brotli, lzma, bzip2, zstd-ultra) and return the * smallest result, tagged with a one-byte codec id so {@link unpack} can * reverse it. Use when output size matters more than compression time. For * the async, lazy-loading form, import `pack` from the package root. */ pack(d: Uint8Array): Uint8Array; /** Reverse {@link pack}. */ unpack(d: Uint8Array): Uint8Array; } /** * Load (or reuse) a process-wide {@link ZipKit} instance. Convenient when you * want the synchronous API without managing the instance yourself. */ export declare function init(): Promise; export {}; //# sourceMappingURL=zipkit.d.ts.map