from_filepath

Function from_filepath 

Source
pub fn from_filepath(path: &Path) -> Option<Mime>
Expand description

Gets the MIME type for a path

Returns None if the file cannot be opened or if no matching MIME type is found.

ยงExamples

use std::path::Path;

// Get path to a GIF file
let path = Path::new("./tests/inputs/image/gif/gif.gif");

// Find the MIME type of the GIF
let result = tika_magic::from_filepath(path);
assert_eq!(result, Some("image/gif"));