Context
Currently, infer maintains an internal MATCHER_MAP with MIME types and extensions, but it's private.
The Problem
Sometimes I already have a MIME string (e.g., from an HTTP header) and want the extension. Currently, I have to add a heavy dependency like mime_guess even though the data already exists inside infer.
Proposed Solution
Expose a simple lookup function or make the matchers iterator public.
Example:
let ext = infer::get_extension("image/jpeg"); // returns Some("jpg")
Context
Currently,
infermaintains an internalMATCHER_MAPwith MIME types and extensions, but it's private.The Problem
Sometimes I already have a MIME string (e.g., from an HTTP header) and want the extension. Currently, I have to add a heavy dependency like
mime_guesseven though the data already exists insideinfer.Proposed Solution
Expose a simple lookup function or make the matchers iterator public.
Example: