Function infer::get_from_path [−][src]
Expand description
Returns the file type of the file given a path.
Errors
Returns an error if we fail to read the path.
Examples
let kind = infer::get_from_path("testdata/sample.jpg")
.expect("file read successfully")
.expect("file type is known");
assert_eq!(kind.mime_type(), "image/jpeg");
assert_eq!(kind.extension(), "jpg");