mime2ext
A simple compact crate to look up a file extension for a mime type.
It embeds part of the mime-db database, packed efficiently into around 20 KiB. There are no dependencies, and it's no_std-compatible.
Example
use mime2ext;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Interoperability with mime
mime's Mime type is supported through its implementation of AsRef<str>, without any dependency on the crate:
use ;
use mime2ext;
assert_eq!;
let mime: Mime = "text/xml; charset=latin1".parse?;
assert_eq!;
Versioning
mime2ext includes a static version of mime-db. A new version of mime2ext has to be released for each new version of mime-db.
mime2ext's version number tracks that of mime-db. mime2ext version 0.1.49 corresponds to mime-db version 1.49.0.
See CHANGELOG.md for differences between versions, including relevant changes to mime-db.
License
Both mime2ext and mime-db are licensed under the MIT license. See LICENSE and mime-db/LICENSE.
See also
mime_guess, which mainly converts in the opposite direction. It can also convert mime types to extensions but often suggests rarely-used extensions, likejpeforimage/jpeg.