Function mime_guess::mime_str_for_path_ext

source ·
pub fn mime_str_for_path_ext<P: AsRef<Path>>(path: P) -> Option<&'static str>
👎Deprecated since 2.0.0: Use from_path(path).first_raw() instead
Expand description

Guess the MIME type string 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.