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 functions and options. Some Node.js
functions also have a synchronous form with the Sync suffix, and the image
family also has the constant formatSupport (FORMAT_SUPPORT in Python).
Input
The functions take the bytes of a file: a Uint8Array in Node.js, for
example a Buffer, and bytes in Python. Some families also accept other
inputs; the image family, for example, accepts any object with the buffer
protocol in Python, and raw images in encode, compareImages, resize,
crop, and alphaBounds. The
detection 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. The functions that decode a file, for example decode
of the image family, need the whole file.
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.