import type { BinaryBuffer } from './buffer'; export declare const UTF8 = "utf8"; export declare const UTF8_with_bom = "utf8bom"; export declare const UTF16be = "utf16be"; export declare const UTF16le = "utf16le"; export declare const UTF16be_BOM: number[]; export declare const UTF16le_BOM: number[]; export declare const UTF8_BOM: number[]; export declare const ZERO_BYTE_DETECTION_BUFFER_MAX_LEN = 512; export declare function isUTF8(encoding: string | null): boolean; export declare function toIconvLiteEncoding(encodingName: string): string; /** * The encodings that are allowed in a settings file don't match the canonical encoding labels specified by WHATWG. * See https://encoding.spec.whatwg.org/#names-and-labels * Iconv-lite strips all non-alphanumeric characters, but ripgrep doesn't. For backcompat, allow these labels. */ export declare function toCanonicalName(enc: string): string; export declare function encodingExists(encoding: string): Promise; export declare function toNodeEncoding(enc: string | null): string; /** * nodejs 内置的 Buffer 转换编码不支持 GBK,使用第三方的 iconv-lite * @param buffer Uint8Array | Buffer * @param encoding 传入的是 SUPPORTED_ENCODINGS 已有的键值(已通过 tests case 的) */ export declare function iconvDecode(buffer: Uint8Array | Buffer, encoding: string): string; export declare function iconvEncode(content: string, encoding: string): Uint8Array | Buffer; export declare function detectEncodingByBOMFromBuffer(buffer: BinaryBuffer | null, bytesRead: number): typeof UTF8_with_bom | typeof UTF16le | typeof UTF16be | null; export interface IDetectedEncodingResult { encoding: string | null; seemsBinary: boolean; } export declare function detectEncodingFromBuffer(buffer: BinaryBuffer, autoGuessEncoding?: false): IDetectedEncodingResult; export declare function detectEncodingFromBuffer(buffer: BinaryBuffer, autoGuessEncoding?: boolean): Promise; export interface IEncodingInfo { id: string; labelLong: string; labelShort: string; } export declare function getEncodingInfo(encoding: string | null): null | IEncodingInfo; //# sourceMappingURL=encoding.d.ts.map