OpenFormatDB

v0.3.0
org.openformatdb/openformatdb Checked 14 hours ago Published 1 month ago

Identify a file, find open tools for its format, convert it locally with WebAssembly.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

identify_file Identify a file

Candidate formats for a file, ranked: a signature match beats a MIME type, which beats an extension. Read the bytes yourself and pass them as hex; the file never leaves the machine: magic_hex = the first bytes (`xxd -p -l 1024 file`), tail_hex = the last bytes (`tail -c 512 file | xxd -p`) so end-of-file signatures can be checked, whole_file when magic_hex is the entire file. Full PRONOM signatures and their priorities decide between close formats (PNG 1.0 / 1.2 / APNG). Then call lookup_format on the best candidate.

ParameterTypeDescription
extensionstringFile name or extension, e.g. report.doc or .doc
limitinteger
magic_hexstringFirst bytes of the file as hex, spaces allowed (1024 bytes recommended)
mimestringMIME type if known, e.g. from `file --mime-type`
tail_hexstringLast bytes of the file as hex (512 bytes recommended)
whole_filebooleanmagic_hex holds the entire file

lookup_format Look up a format

Full record of a format: identifiers, which software reads or writes it (open source first), grammars, specification, family and versions, live claims, and advice on what to do next. Find it by id, PRONOM PUID, Wikidata QID, or MIME type.

ParameterTypeDescription
idstringOpenFormatDB id, from identify_file or search_formats
mimestring
puidstringPRONOM id, e.g. fmt/13
wikidatastringWikidata QID, e.g. Q178051

search_formats Search formats

Ranked formats matching a name, alias, extension, MIME type, PUID or QID, optionally by category or status.

ParameterTypeDescription
query *string
categorystring
limitinteger
statusstringunknown, in-progress, partial, readable (open code reads it), writable (open code writes it)

find_conversion Find a conversion

How to convert a file from one format to another with open tools: the cheapest chains (lossless first), each step with its tool, command and what is lost. Formats as ids or extensions ("docx", "report.wpd"). Without `to`, lists the direct conversions.

ParameterTypeDescription
from *stringSource format id, extension or file name
max_stepsintegerLongest chain (default 3)
tostringTarget format id, extension or file name

convert_file Convert a file locally

Convert a file on this machine to another format with open-source converters compiled to WebAssembly: ImageMagick (images, raw photos), resvg (SVG), FFmpeg (audio, video), Pandoc (documents, markup), 7-Zip (archives), GDAL (geodata), Assimp (3D). Nothing is uploaded. Each engine is downloaded once on first use (2 to 59 MB, pinned versions, SHA-256 checked) into ~/.cache/openformatdb/engines. Call with only `path` to list what the file can become; chains of two engines are planned automatically (svg → png → webp). Writes next to the input unless `output` is given, and never overwrites a fil…

ParameterTypeDescription
path *stringFile to convert (absolute, or relative to the server's working directory)
outputstringOutput file path (default: next to the input, same name, new extension)
tostringTarget extension: webp, mp3, docx, kml, glb, zip…

list_sources List sources

Sources aggregated in OpenFormatDB, with record counts, licences and snapshot dates.

claim_format Claim a format

Say you are reverse engineering or documenting a format, so nobody duplicates the work: adds a claim (who, contact, scope, up to 90 days) to data/formats/<id>.yaml, creating the record if the format is new. Call lookup_format first.

ParameterTypeDescription
contact *stringHow others reach the claimant: email, GitHub handle, issue URL
scope *stringWhat you will document, e.g. "header and index", "full read support"
who *stringWho is working on it: your human's name or handle
agentstringAgent/tooling used
categorystringRequired only for a new format
daysintegerClaim duration (default 30, max 90)
extensionsarrayExtensions of a new format, without the dot
force_newbooleanCreate a new record even though a similar format exists
idstringFormat id if it exists (from identify_file, lookup_format or search_formats). Otherwise give name + category.
namestringFormat name, for a format not in OpenFormatDB yet
versionstring

publish_findings Publish findings

Merge what you found into data/formats/<id>.yaml: structure, grammars, tools, conversions, specification, identifiers, verification. Status only moves forward. Optionally release your claim. Then open a pull request.

ParameterTypeDescription
id *stringFormat id
patch *object
allow_downgradebooleanAllow lowering the status (explain why in the summary or a verification note)
release_claim_ofstringRemove the live claims of this claimant now that the work is published