mime-sniffer

Detecting mime types base on content sniffer.
The detection workflow was copied from Chromium
For more detail, please read How Mozilla determines MIME Types.
Usage
To use mime-sniffer
, first add this to your Cargo.toml
:
[]
= "^0.1"
Then, add this to your crate root:
extern crate mime_sniffer;
use MimeTypeSniffer;
And then, use hash function with module or hasher
use MimeTypeSniffer;
assert_eq!;
Examples
extern crate url;
extern crate mime;
extern crate mime_sniffer;
use Url;
use ;
let url = parse.unwrap;
let req = HttpRequest ;
assert!;
assert_eq!;
assert_eq!;
Related
- To recognize binary file type, you may need libmagic with rust binding rust-magic crate.
- To guess MIME type by file extension, you may need mime_guess crate.
- To manage MIME type as strong types, you may need mime.rs crate.