[−][src]Function tree_magic::from_filepath
pub fn from_filepath(filepath: &Path) -> String
Gets the type of a file from a filepath.
Does not look at file name or extension, just the contents. Returns MIME as string.
Examples
use std::path::Path; // Get path to a GIF file let path: &Path = Path::new("tests/image/gif"); // Find the MIME type of the GIF let result = tree_magic::from_filepath(path); assert_eq!(result, "image/gif");