Media Type Database, looks up `extension` or `media type`
shell
cargo add mime-db
```rust use mime_db::{extension, extensions, lookup};
asserteq!(lookup("json").unwrap(), "application/json"); asserteq!(lookup(".md").unwrap(), "text/markdown"); asserteq!(lookup("folder/file.js").unwrap(), "application/javascript"); asserteq!(lookup("folder/.htaccess"), None); assert_eq!(lookup("cats"), None);
assert!(extensions2("application/octet-stream").eq([ "bin", "dms", "lrf", "mar", "so", "dist", "distz", "pkg", "bpk", "dump", "elc", "deploy", "exe", "dll", "deb", "dmg", "iso", "img", "msi", "msp", "msm", "buffer" ] .iter() .cloned()));
assert_eq!(extension("application/octet-stream").unwrap(), "bin"); ```
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.