Skip to main content

detect_mime

Function detect_mime 

Source
pub fn detect_mime(url: &str, content_bytes: Option<&[u8]>) -> Option<String>
Expand description

Detect MIME type from URL + optional content bytes.

Detection order:

  1. Extension lookup via mime_guess (cheap, synchronous)
  2. Content-byte sniffing via infer only when extension lookup is missing or ambiguous

Returns None when neither source yields a known MIME type.