Function tree_magic_mini::from_file
source · pub fn from_file(file: &File) -> Option<&'static str>
Expand description
Gets the MIME type of a file.
Does not look at file name or extension, just the contents.
Examples
use std::fs::File;
// Get path to a GIF file
let file = File::open("tests/image/gif").unwrap();
// Find the MIME type of the GIF
let result = tree_magic_mini::from_file(&file);
assert_eq!(result, Some("image/gif"));