Resolves media types without applying a provider-independent default.
Adapters should use evidence in this order:
- A valid MIME value declared by the provider.
- A default that the provider contract guarantees for the downloadable file.
- A valid HTTP
Content-Type, when it comes from the media download response. - A file signature, when the bytes have already been downloaded.
- A filename or URL extension as a best-effort hint.
Pass the provider payload value as the first argument to resolve/2. Pass a
download response Content-Type as :response_media_type. A provider default
is never added unless the caller supplies :provider_default. Normalization
and MIME resolution do not change media bytes.
Summary
Functions
Returns a MIME hint from a filename, path, or URL extension.
Returns the canonical media kind from MIME data or a reference hint.
Returns a normalized MIME value or nil for blank and invalid values.
Resolves the best available MIME value.
Detects common binary formats from their file signatures.
Types
Functions
Returns a MIME hint from a filename, path, or URL extension.
Returns the canonical media kind from MIME data or a reference hint.
Returns a normalized MIME value or nil for blank and invalid values.
Resolves the best available MIME value.
Supported options are :provider_default, :response_media_type, :data,
:filename, :url, and :path. Filename and reference values are hints and
have the lowest priority.
Detects common binary formats from their file signatures.