For AI agents: the complete documentation index is available at https://anyformat.swc.rs/llms.txt, the full documentation bundle is available at https://anyformat.swc.rs/llms-full.txt, and this page is available as Markdown at https://anyformat.swc.rs/api/index.md.

API reference

Each format family is one package for Node.js and one package for Python. The two packages of a family have the same API.

FamilyNode.js functionsPython functions
Imagedetect, supportedFormatsdetect, supported_formats
Audiodetect, supportedFormatsdetect, supported_formats
Videodetect, supportedFormatsdetect, supported_formats
Fontdetect, supportedFormatsdetect, supported_formats
PDFisPdf, detectVersionis_pdf, detect_version
Officedetect, supportedFormatsdetect, supported_formats

Input

Each function takes the bytes of a file: a Uint8Array in Node.js, for example a Buffer, and bytes in Python. The functions read only the leading bytes, so you can give them the start of a file and not the whole file. The page of each family tells how many bytes it needs.

Names in each language

The Node.js API uses camel case, and the Python API uses snake case. A null result in Node.js is None in Python.