Install any skill in seconds. Free to start, no credit card required.
Get Started Free →MIME type detection and extractor routing in core/mime.rs and core/extractor/bytes.rs — the extension→EXT_TO_MIME→validate→registry→extractor flow, key detection functions, the 115 case-insensitive extension map, priority-based registry selection, wildcard MIME families, and how to add a new MIME type. Load when adding a format, wiring an extractor to a MIME type, or debugging why a file routes to the wrong (or no) extractor.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | -27% | 0% |
| case-02 | ✗→✓ | ▲ Improved | -18% | 0% |
| case-07 | ✗→✓ | ▲ Improved | -16% | 0% |
| case-08 | ✗→✓ | ▲ Improved | -43% | 0% |
| case-09 | ✗→✓ | ▲ Improved | -26% | 0% |
textExtension -> EXT_TO_MIME map -> validate -> Registry lookup -> Extractor
| Function | Location | Purpose | | ------------------------------------ | -------------- | --------------------------------------- | | detect_mime_type(path, inspect) | core/mime.rs | Extension + optional content inspection | | detect_mime_type_from_bytes(bytes) | core/mime.rs | Magic number detection (infer crate) | | validate_mime_type(mime) | core/mime.rs | Check if any extractor supports it |
115 extensions mapped in EXT_TO_MIME (core/mime.rs). Case-insensitive.
Key mappings: .pdf -> application/pdf, .docx -> application/vnd.openxmlformats-officedocument.wordprocessingml.document, .xlsx -> spreadsheet variant, .png/.jpg -> image/*
rust// In core/extractor/bytes.rs fn select_extractor_for_mime(mime_type: &str) -> Result<Arc<dyn DocumentExtractor>> { let registry = get_document_extractor_registry(); let registry_guard = registry.read()?; registry_guard.get_for_mime_type(mime_type) .ok_or_else(|| XbergError::UnsupportedFormat(mime_type.into())) }
Selects highest-priority extractor registered for that MIME type.
m.insert("ext", "application/x-new"); in core/mime.rsDocumentExtractor with supported_mime_types() returning the MIMEregister_default_extractors()Extractors can register for MIME type families: "image/*" matches image/png, image/jpeg, etc.
validate_mime_type() before extractionOther measured skills in the registry, with their headline benchmark lift.