mirror of
https://git.sr.ht/~ehmry/freedesktop_org
synced 2026-01-02 21:24:39 +00:00
No description
| src | ||
| .gitignore | ||
| .sbom.json.autoupdate | ||
| depends.tup | ||
| freedesktop_org.nimble | ||
| README.md | ||
| sbom.json | ||
| Tupfile | ||
| Tuprules.tup | ||
freedesktop_org
Some Nim procedures for looking up freedesktop.org data.
Samples
let path = "freedesktop_org.html"
let exec = defaultApplicationExec("text/html", path)
assert exec == @["firefox freedesktop_org.html"]
assert mimeTypeOf(path) == @["text/html", "application/xhtml+xml"]
let data = newStringStream(readFile path)
assert mimeTypeOf(data) == @["application/xhtml+xml", "text/html", "application/xml"]
Alternatives
Filetype
The filetype library also provides MIME type detection but ships with its own heuristics. This makes it work without relying on system MIME database but the standard freedesktop.org.xml file already comes with more MIME types than provided by the filetype library.
std/mimetypes
The Nim standard library has a library with Mime-type to filename-extension mappings but is also not extensible at runtime.
Acknowledgment
This library was initially written as part of the ERIS standardization project. As such this library was indirectly funded by NGI Assure, a fund established by NLnet with financial support from the European Commission's Next Generation Internet program.