/** * Opt-in response decompression. Most runtimes (Node 22+, Bun, Deno) auto- * decompress gzip/br responses at the fetch layer; this module exists for * formats they don't (zstd, until widely shipped) and for custom drivers * that don't decompress at all. */ export type DecompressFormat = "gzip" | "deflate" | "deflate-raw" | "br" | "zstd"; /** * Capability-test which formats the runtime's `DecompressionStream` * actually supports. Returns the intersection of the user's request and * runtime support. */ export declare function detectSupportedFormats(requested: readonly DecompressFormat[] | true): DecompressFormat[]; /** * Wrap a Response in a DecompressionStream when its `Content-Encoding` * matches one of the formats AND the body hasn't already been decoded. * * Heuristic for "already decoded": if the runtime delivered a decoded * response, `Content-Length` typically no longer matches the encoded size * and `Content-Encoding` may be stripped. We act conservatively — only * decompress when `Content-Encoding` is still present. */ export declare function maybeDecompress(response: Response, formats: readonly DecompressFormat[]): Response; /** * Build the `Accept-Encoding` header value from a runtime-supported list. * Returns undefined if the list is empty (don't advertise nothing). */ export declare function acceptEncodingFor(formats: readonly DecompressFormat[]): string | undefined;