Crate mime_more

Crate mime_more 

Source
Expand description

The crate is a utility crate for MIME type handling. It provides from_ext, from_path with extension feature (implemented via mime_guess crate), and from_content with magic feature (implemented via infer crate). We also provide a lighter version of from_ext and from_path with common extensions.

This crate was born out of a discussion of the behaviour of MIME inferencing in the Rolldown project Data URLs.

Structs§

Mime
A wrapper around the mime crate’s Mime type, with additional functionality including from_ext, from_path, and from_content, etc.

Functions§

from_ext_and_content
Guesses the MIME type from the extension and content. It is a combination of from_ext and from_content, and set the priority of from_content higher than from_ext. If the function can’t guess the MIME type, it will return application/octet-stream if the feature texture is disabled, otherwise it will return text/plain if the data is a texture or application/octet-stream if the data is not a texture.
from_path_and_content
Guesses the MIME type from the path and content. It is a combination of from_path and from_content, and set the priority of from_content higher than from_path. If the function can’t guess the MIME type, it will return application/octet-stream if the feature texture is disabled, otherwise it will return text/plain if the data is a texture or application/octet-stream if the data is not a texture.