Function mime_guess::guess_mime_type_opt [−][src]
pub fn guess_mime_type_opt<P: AsRef<Path>>(path: P) -> Option<Mime>
Guess the MIME type of path
by its extension (as defined by Path::extension()
).
If path
has no extension, or its extension has no known MIME type mapping,
then None
is returned.
Note
Guess is the operative word here, as there are no guarantees that the contents of the file
that path
points to match the MIME type associated with the path's extension.
Take care when processing files with assumptions based on the return value of this function.