Skip to content

Proposal: Access extension by MIME type string #120

Description

@surkaa

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")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions