mime-detection-routing
Installation
SKILL.md
MIME Detection & Routing
Detection Flow
Policy -> content and/or extension evidence -> validate_mime_type -> registry.get(mime) -> extractor
Key Functions
| Function | Location | Behaviour |
|---|---|---|
detect_mime_type(path, check_exists: bool) |
core/mime.rs |
Path-based only — never reads bytes. Lowercased extension → EXT_TO_MIME, then tree-sitter extension detection (feature tree-sitter), then mime_guess::from_path. check_exists gates a file-existence check, not content inspection. |
detect_mime_type_from_bytes(bytes) |
core/mime.rs |
Magic-number detection via the infer crate. The only content-sniffing entry point. |
validate_mime_type(mime) |
core/mime.rs |
Parses the media type, matches its case-insensitive essence against SUPPORTED_MIME_TYPES, and returns the registered MIME spelling. Parameters such as charset do not affect extractor routing. It does not consult the extractor registry. |