import type { HeaderMap } from "./headers.js"; export type SupportedEncodings = { gzip(): boolean; deflate(): boolean; br(): boolean; zstd(): boolean; }; /** * Represents various content encodings used for compression and decompression. * * This class is used to define well-known encoding formats, provide * functionality for parsing and resolving encodings based on client preferences * or available support and determine the preferred encoding from a list of * accepted encodings. * * Encodings are defined as static constants in this class, such as GZIP, * DEFLATE, etc. Each encoding includes a string identifier and an optional * file extension. * * Instances of this class cannot be directly instantiated and must be accessed * via the static constants or methods provided. */ export declare class Encoding { static readonly IDENTITY: Encoding; static readonly DEFLATE: Encoding; static readonly GZIP: Encoding; static readonly BROTLI: Encoding; static readonly ZSTD: Encoding; /** * Value of the encoding as represented in headers. */ readonly value: string; /** * File extension associated with the encoding, if any. */ readonly fileExtension: string | null; private constructor(); /** * Determines the preferred encoding from the provided headers and * supported encodings. */ static fromHeaders(headers: HeaderMap, supportedEncodings: SupportedEncodings): Encoding; /** * Determines the preferred encoding from a list of accepted encodings and * their associated quality values. */ static preferredEncoding(acceptedEncodings: [Encoding, number][]): Encoding | null; } /** * Parses the `accept-encoding` headers and returns a list of pairings of * supported encodings and their associated quality values (q-values). */ export declare const encodings: (headers: HeaderMap, supportedEncodings: SupportedEncodings) => [Encoding, number][]; /** * Parses a Q-value string from an input and returns its numerical * representation. * * The Q-value string is a weight factor used in HTTP headers, typically in the * format "q=value", where the value is a floating-point number between 0 and 1 * inclusive with up to three decimal places. * * The returned value is multiplied by 1000 to ensure it's an integer between * 0 and 1000 inclusive. If the input is invalid or the Q-value is not within * the valid range, null is returned. */ export declare const parseQValue: (value: string) => number | null;