Function mime_guess::guess_mime_type [] [src]

pub fn guess_mime_type(path: &Path) -> Mime

Guess the MIME type of the Path by its extension.

If the given Path has no extension, or its extension has no known MIME type mapping, then the MIME type is assumed to be application/octet-stream.

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.