import { DecodeTextOptions, UndecodableTextError } from "byte-codec"; //#region src/csv/text.d.ts /** Thrown when csv bytes cannot be decoded as text at all: they are binary, they contradict an encoding the caller declared or a byte order mark named, or they match none of the encodings byte-codec's decodeText supports. */ declare class CsvUndecodableTextError extends Error { /** Which of those three it was, carried through from byte-codec so a caller can branch on it without unwrapping `cause`. */ readonly reason: UndecodableTextError["reason"]; constructor(cause: UndecodableTextError); } /** * Decodes csv bytes to text, working the character encoding out from the bytes. * @param bytes - The csv bytes. * @param options - An explicit `encoding` to decode under, skipping detection. Reach for it when the bytes are in an encoding detection cannot see, a mark-less UTF-16 file holding CJK text being the case that occurs. * @throws CsvUndecodableTextError When the bytes are not text, or match none of the supported encodings. * @returns The csv text. */ declare function decodeCsvText(bytes: Uint8Array, options?: DecodeTextOptions): string; /** * Encodes csv text as UTF-8 bytes. * @param text - The csv text. * @returns The UTF-8 bytes, whatever encoding the text was originally decoded from. */ declare function encodeCsvText(text: string): Uint8Array; //#endregion export { CsvUndecodableTextError, decodeCsvText, encodeCsvText };