mime-tools 0.1.0
Map file extensions to MIME types and back, and sniff the type of data from its magic bytes
Install
cargo add mime-tools --registry rupm
In Ruststudio: Packages, search for mime-tools, Install.
Owner: Rust Studio. Licence: MIT OR Apache-2.0. Total downloads: 0. Published 2026-11-22.
Versions
- 0.1.0 2026-11-22
README
# mime-tools
Map file extensions to MIME types and back, and sniff the type of data from its magic bytes
Add it with `rupm add mime-tools` (or `cargo add mime-tools --registry rupm`).
```rust
assert_eq!(mime_tools::mime_from_extension("PNG"), Some("image/png"));
assert_eq!(mime_tools::mime_from_path("site/app.js"), Some("text/javascript"));
assert_eq!(mime_tools::extension_from_mime("application/json; charset=utf-8"), Some("json"));
assert_eq!(mime_tools::sniff(b"%PDF-1.7 ..."), Some("application/pdf"));
```