Function tree_magic::from_u8
source · 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::from_u8(input);
assert_eq!(result, "image/gif");