Function tree_magic::from_vec_u8_node [] [src]

pub fn from_vec_u8_node(parentnode: NodeIndex, bytes: Vec<u8>) -> Option<String>

Gets the type of a file from a vector of bytes, starting at a certain node in the type graph.

Returns mime as string wrapped in Some if a type matches, or None if no match is found. Retreive the node from the TYPE.hash HashMap, using the MIME as the key.

Panics

Will panic if the given node is not found in the graph. As the graph is immutable, this should not happen if the node index comes from TYPE.hash.