Function match_file

Source
pub fn match_file(mimetype: &str, file: &File) -> bool
Expand description

Check if the given file matches the given MIME type.

ยงExamples

use std::fs::File;

// Get path to a GIF file
let file = File::open("./tests/inputs/image/gif/gif.gif").unwrap();

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