/** * Zstd dictionary compression — the big win for many small, *similar* payloads * (log lines, JSON records, RPC messages, chat-history entries). Train a * dictionary once from representative samples, then compress each small payload * against it: the shared structure lives in the dictionary instead of being * repeated in every frame, so tiny inputs shrink dramatically. * * Backed by the engine's `ZDICT_trainFromBuffer` + `ZSTD_*_usingDict`. The * resulting frames are standard zstd-with-dictionary — interoperable with any * zstd that is given the same dictionary. * * @example * ```ts * import { trainDictionary, compressWithDictionary, decompressWithDictionary } from '@myrialabs/zipkit'; * const dict = await trainDictionary(logLines); // Uint8Array[] * const packed = await compressWithDictionary(oneLine, dict); * const back = await decompressWithDictionary(packed, dict); * ``` */ import type { CompressOptions, DecompressOptions } from './types.js'; /** Options for {@link trainDictionary}. */ export interface TrainOptions { /** Target dictionary size in bytes (default 112 640 — zstd's own default). */ maxSize?: number; } /** * Train a zstd dictionary from representative `samples`. More, smaller samples * that share structure train a better dictionary; zstd recommends at least ~100 * samples. Throws {@link ZipKitError} if training fails (typically too few or * too-uniform samples). */ export declare function trainDictionary(samples: Uint8Array[], opts?: TrainOptions): Promise; /** Compress `data` against `dict`. Level follows the usual zstd 1–22 scale. */ export declare function compressWithDictionary(data: Uint8Array, dict: Uint8Array, opts?: CompressOptions): Promise; /** Decompress `data` produced by {@link compressWithDictionary} with the same `dict`. */ export declare function decompressWithDictionary(data: Uint8Array, dict: Uint8Array, opts?: DecompressOptions): Promise; //# sourceMappingURL=dictionary.d.ts.map