/** * @file Gzip compression / decompression — same calling shapes as brotli: * in-memory, file-to-file, and raw-stream variants. Default level is 6 (zlib * default). The decompress-file helper recognises `.gz` / `.gzip` / `.tgz`, * and special-cases `.tgz` back to `.tar` on inPlace decompress so a * round-trip stays lossless. await compressGzip(JSON.stringify(payload)) * await compressGzipFile('input.json', 'input.json.gz') * readable.pipe(createGzipCompressor()).pipe(writable) */ import type { Buffer } from 'node:buffer'; import type { ZlibOptions } from 'node:zlib'; import type { CompressFileOptions, CompressOptions } from './types.js'; export declare const GZIP_EXTS: ReadonlySet; /** * Compress a string or Buffer with gzip. Strings are encoded as UTF-8 before * compression. Default level is 6, matching zlib's own default. */ export declare function compressGzip(input: string | Buffer, options?: CompressOptions | undefined): Promise; /** * Stream-compress a file with gzip. Two call shapes: * * CompressGzipFile(src, dest, options?) Writes compressed output to `dest`. * Source is left intact. * * CompressGzipFile(src, { inPlace: true, ...options }) Writes to `.gz` and * deletes `src` after the write succeeds. Returns the new path. */ export declare function compressGzipFile(srcPath: string, destPath: string, options?: CompressOptions | undefined): Promise; export declare function compressGzipFile(srcPath: string, options: CompressFileOptions): Promise; /** * Create a gzip compress transform stream. */ export declare function createGzipCompressor(options?: CompressOptions | undefined): import("node:zlib").Gzip; /** * Create a gzip decompress transform stream. * * @unused No internal or Socket consumers — exercised only by its unit tests. */ export declare function createGzipDecompressor(): import("node:zlib").Gunzip; /** * Decompress a gzip-compressed Buffer. */ export declare function decompressGzip(input: Buffer): Promise; /** * Stream-decompress a gzip file. Two call shapes: * * DecompressGzipFile(src, dest) Writes decompressed output to `dest`. Source is * left intact. * * DecompressGzipFile(src, { inPlace: true }) Strips the `.gz`/`.gzip`/`.tgz` * suffix to derive the destination, then deletes the compressed source after * the write succeeds. Throws if `src` has no recognizable extension. */ export declare function decompressGzipFile(srcPath: string, destPath: string): Promise; export declare function decompressGzipFile(srcPath: string, options: CompressFileOptions): Promise; /** * Extension check for gzip paths — matches `.gz` / `.gzip` / `.tgz` * (case-insensitive). Naming follows node:path's `extname`. */ export declare function hasGzipExt(filePath: string): boolean; /** * Magic-byte check for gzip. Reads the first two bytes and matches the gzip * spec's 0x1f 0x8b signature. Authoritative. * * @unused No internal or Socket consumers — exercised only by its unit tests. */ export declare function isGzipCompressed(input: Buffer): boolean; /** * Translate `CompressOptions` into the `ZlibOptions` zlib expects. Returns an * empty options object when no `level` is given (zlib uses its default, level * 6). Exposed for parity with `resolveBrotliOptions` and for unit-test * coverage. */ export declare function resolveGzipOptions(options: CompressOptions | undefined): ZlibOptions;