/** * Format auto-detection from magic bytes. * * Recognizes the container/codec of a buffer by inspecting its header. Two * groups are reported: * * - **Directly decompressible** by {@link import('./compress.js').decompress}: * gzip, zlib, zstd. * - **Recognized but not auto-decoded here** — ZIP and the standard external * framings (tar, xz, 7z, standard bzip2, the LZ4 *frame*). These need a * dedicated reader (`unzip`/`untar`/`unSevenZip`/`extractStream` from * `@myrialabs/zipkit`) or an explicit codec, so * {@link import('./compress.js').decompress} points you at the right API * rather than guessing. * * ZipKit's own brotli, snappy, raw LZ4 *block*, and length-prefixed lzma/bzip2 * streams have no leading magic and return `undefined`; decode them with an * explicit codec via `decompressWith`. */ /** * A format ZipKit can recognize from its header bytes. Only formats with a * reliable leading signature are detectable; everything else needs an explicit * codec via `decompressWith`. */ export type DetectedFormat = 'gzip' | 'zlib' | 'zstd' | 'zip' | 'tar' | 'xz' | '7z' | 'bzip2' | 'lz4-frame'; /** Whether {@link decompress} can reverse a detected format without extra API. */ export declare function isDirectlyDecompressible(fmt: DetectedFormat): boolean; /** * Identify the format of a buffer, or `undefined` if it has no recognizable * signature. * * Detectable: **gzip, zlib, zstd, ZIP, tar, xz, 7z, standard bzip2, and the LZ4 * frame**. Headerless or ZipKit-framed codecs — brotli, snappy, the raw LZ4 * *block* written by {@link import('./codecs/lz4.js').lz4}, and the * length-prefixed lzma/bzip2 streams ZipKit emits — have no leading magic and * return `undefined`; decode them with an explicit codec via `decompressWith`. * * @example * ```ts * detectFormat(gzipBytes); // 'gzip' * detectFormat(zipBytes); // 'zip' * detectFormat(tarBytes); // 'tar' * detectFormat(brotliBytes); // undefined * ``` */ export declare function detectFormat(data: Uint8Array): DetectedFormat | undefined; //# sourceMappingURL=detect.d.ts.map