Function tree_magic_mini::from_u8
source · pub fn from_u8(bytes: &[u8]) -> &'static str
Expand description
Gets the type of a file from a byte stream.
Returns MIME as string.
Examples
// Load a GIF file
let input: &[u8] = include_bytes!("../tests/image/gif");
// Find the MIME type of the GIF
let result = tree_magic_mini::from_u8(input);
assert_eq!(result, "image/gif");