/** * Supported Gedcom file encoding schemes. */ export declare const enum FileEncoding { Utf8 = "UTF-8", Ansel = "ANSEL", Cp1252 = "Cp1252", Macintosh = "Macintosh", Cp850 = "Cp850", Utf16be = "UTF-16be", Utf16le = "UTF-16le" } /** * Early detectable file metadata. * Can be used to infer the file encoding with high confidence. */ export interface FileMetadata { /** * The source encoding value, as defined in the header. */ sourceEncoding: string | null; /** * The source provider value, as defined in the header. */ sourceProvider: string | null; /** * The source provider's version value, as defined in the header. */ sourceProviderVersion: string | null; /** * Whether this file contains a byte order marker (BOM). */ fileHasBOM: boolean; } /** * Extracts the file metadata (see {@link FileMetadata}). The metadata can then be used to guess the actual charset of the file. * To circumvent the bootstrapping problem this function restricts its reading to the first lines of the file only, and * decodes them as UTF-8. * @param buffer The content of the file * @param maxPeekBytes Maximum number of bytes to read * @param maxPeekLines Maximum number of lines to read */ export declare const getFileMetadata: (buffer: ArrayBuffer, maxPeekBytes?: number, maxPeekLines?: number) => FileMetadata; /** * Detects the file charset using a set of heuristics. Has proven to work great in practice. * If you encounter a file for which this procedure doesn't work as intended please do open an issue * at: https://github.com/arbre-app/read-gedcom/issues. * @param buffer The content of the file */ export declare const detectCharset: (buffer: ArrayBuffer) => FileEncoding;