match_filepath

Function match_filepath 

Source
pub fn match_filepath(mimetype: &str, path: &Path) -> bool
Expand description

Check if the file at the given path matches the given MIME type.

Returns false if the file could not be read or the given MIME type is not known.

ยงExamples

use std::path::Path;

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

// Check if the MIME and the file are a match
let result = tree_magic_mini::match_filepath("image/gif", path);
assert_eq!(result, true);