zumime tells what a file is from its bytes and from its name, with no dependency and no system library.
mime_sniff() runs the WHATWG MIME Sniffing Standard
over a raw vector or paths, with a supplied type, the no-sniff flag and
a sniffing context, and reports the charset the bytes declare and their
line endings."probable": XML dialects by
root element and namespace, JSON and its dialects by top-level keys,
NDJSON, line formats such as vCard, iCalendar, WebVTT and PEM, and
scripts by their shebang.mime_type() types paths from bytes and name in one C
loop, says whether the two agree, and reports what a consumer needs
before opening a file: the type inside a compression wrapper,
encryption, completeness (with complete = TRUE), line
endings and a script’s interpreter. Directories, FIFOs, devices and
sockets are typed inode/* without being opened.mime_check() answers whether files are one of a set of
allowed types from their bytes alone, with the same answer as
mime_type().mime_sniffer(), mime_push() and
mime_finish() sniff a stream chunk by chunk and answer as
soon as the bytes decide the type.mime.types: mime_types(),
mime_guess(), mime_extensions(),
mime_parent() and mime_is(). Every type has a
parent, ending at application/octet-stream;
zumime_info()$table_version dates the sources.mime_parse() and mime_format() parse and
serialise a MIME type as the WHATWG standard defines it.mime_register() and mime_unregister() add
a type for the session, with a data rule matched in C or a function rule
called from R. Either refines only what zumime sniffs in the default
context.inner = "decompress" (zukomp), text = "family"
(zucsv, zujson, zutoml) and charset = "detect"
(zuutf).