export interface Codec { /** Decode raw bytes in the given encoding to a JS string. */ decode(bytes: Uint8Array, encoding: string): string; /** Encode a JS string to raw bytes in the given encoding. */ encode(text: string, encoding: string): Uint8Array; } /** Normalize an iconv-style encoding name to a WHATWG TextDecoder label. */ export declare function normalizeEncoding(name: string | null | undefined): string; export declare class DefaultCodec implements Codec { private decoders; private encoders; private utf8Encoder; private decoderFor; decode(bytes: Uint8Array, encoding: string): string; /** Build a reverse map (codepoint -> byte) for a single-byte encoding. */ private reverseTable; encode(text: string, encoding: string): Uint8Array; } export declare const defaultCodec: Codec; /** * Port of readstat_convert(): strip trailing spaces and NULs, then decode. * `maxLen` (dst_len - 1 in C) bounds the *decoded* result is not enforced here * because JS strings are not fixed-width; callers that need the C length checks * use the raw byte length instead. */ export declare function convertString(codec: Codec, src: Uint8Array, encoding: string, offset?: number, len?: number): string;