/** The kinds a path is read as. */ export declare const KINDS: readonly ["image", "pdf", "office", "sheet", "video", "audio", "recording", "text", "unknown"]; /** `office` is a word processor or slide document, `sheet` a spreadsheet, `recording` a handle such as `session:`, * `text` a file the host's own text read serves. */ export type Kind = (typeof KINDS)[number]; /** Bytes of a file's head that `sniffKind` and `imageHeader` read: a JPEG's size sits after its metadata segments. */ export declare const SNIFF_BYTES: number; /** What the bytes are: how a message names them, the kind they make on their own, and their MIME type. A zip archive * and an OLE2 container hold many kinds; only the file's name says which. */ declare const FORMATS: { readonly png: readonly ["a PNG image", "image", "image/png"]; readonly jpeg: readonly ["a JPEG image", "image", "image/jpeg"]; readonly gif: readonly ["a GIF image", "image", "image/gif"]; readonly webp: readonly ["a WebP image", "image", "image/webp"]; readonly bmp: readonly ["a BMP image", "image", "image/bmp"]; readonly tiff: readonly ["a TIFF image", "image", "image/tiff"]; readonly heic: readonly ["a HEIC image", "image", "image/heic"]; readonly avif: readonly ["an AVIF image", "image", "image/avif"]; readonly pdf: readonly ["a PDF document", "pdf", "application/pdf"]; readonly rtf: readonly ["an RTF document", "office", null]; readonly mp4: readonly ["an MP4 video", "video", "video/mp4"]; readonly mov: readonly ["a QuickTime video", "video", "video/quicktime"]; readonly webm: readonly ["a WebM video", "video", "video/webm"]; readonly mkv: readonly ["a Matroska video", "video", "video/x-matroska"]; readonly mp3: readonly ["an MP3 audio file", "audio", "audio/mpeg"]; readonly wav: readonly ["a WAV audio file", "audio", "audio/wav"]; readonly ogg: readonly ["an Ogg audio file", "audio", "audio/ogg"]; readonly flac: readonly ["a FLAC audio file", "audio", "audio/flac"]; readonly m4a: readonly ["an M4A audio file", "audio", "audio/mp4"]; readonly zip: readonly ["a zip archive", "unknown", null]; readonly ole2: readonly ["an OLE2 container (a legacy Office file)", "unknown", null]; readonly empty: readonly ["an empty file", "text", null]; readonly text: readonly ["text", "text", null]; readonly binary: readonly ["binary data in no format this package reads", "unknown", null]; }; /** A format a file's first bytes name; `FORMATS` gives each its words and the kind it reads as. */ export type SniffedFormat = keyof typeof FORMATS; /** The pixels a header states, the EXIF orientation (1 to 8; 1 when the file states none), the MIME type, and whether a * JPEG is progressive. `width` and `height` are the stored ones: a quarter-turn orientation (5 to 8) shows the image * the other way round. */ export type ImageHeader = { readonly mimeType: string; readonly width: number; readonly height: number; readonly orientation: number; readonly progressive?: true; }; /** The size, orientation and MIME type a PNG, JPEG, GIF, WebP, BMP or TIFF states in its first bytes, from at most * `SNIFF_BYTES` of the file (an extended WebP's EXIF chunk is looked for by chunks, past them); null when the bytes are * another format or the header is cut short or states no size. */ export declare function imageHeader(whole: Uint8Array): ImageHeader | null; /** Whether a header's pixels are over what any decoder here is asked to open: a decompression bomb is refused before a * decoder allocates for it. */ export declare const exceedsDecodeGuard: (size: { readonly width: number; readonly height: number; }) => boolean; /** What a source is, or why the two ways of telling disagree. `format` and `signature` (the first bytes in hex) are for * a message; `kind` `unknown` is bytes in no format this package reads, which the caller reports as `unsupported`. */ export type Sniffed = { readonly ok: true; readonly kind: Kind; readonly format: SniffedFormat; readonly mimeType: string | null; readonly signature: string; } | { readonly ok: false; readonly code: "unsupported"; readonly reason: string; }; /** The kind of a file from the first `SNIFF_BYTES` of it and its name. The bytes decide; the name decides only what a * container (zip, OLE2) holds. A name that claims one kind over bytes of another is a miss naming both. A recording is a * handle, not bytes: the host's source table decides that, never this function. */ export declare function sniffKind(head: Uint8Array, name: string): Sniffed; export {};