No description
Find a file
2025-07-22 10:59:17 +01:00
src Rename mimeType to mediaType 2025-07-22 10:59:17 +01:00
.gitignore Replace Nimble with CycloneDX 2024-06-01 12:22:39 +03:00
.sbom.json.autoupdate Rename mimeType to mediaType 2025-07-22 10:59:17 +01:00
depends.tup Rename mimeType to mediaType 2025-07-22 10:59:17 +01:00
freedesktop_org.nimble *.nimble: swap nim:bin key and value 2024-09-30 17:02:43 +01:00
README.md Mention std/mimetypes in README 2023-04-18 09:25:05 -05:00
sbom.json Rename mimeType to mediaType 2025-07-22 10:59:17 +01:00
Tupfile Rename mimeType to mediaType 2025-07-22 10:59:17 +01:00
Tuprules.tup Rename mimeType to mediaType 2025-07-22 10:59:17 +01:00

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.

NGIAssure