[][src]Function tree_magic::from_u8

pub fn from_u8(bytes: &[u8]) -> String

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");