Mime Type Lookup

Bounded off line common file-extension MIME inventory (10explicit entries), case fold/optional one leading dot. Not a completeIANA/media-type database, content-sniffing security verdict or evidence actual bytes match label.

Description

A media type describes a file or representation using a type/subtype name.

A media type describes a file or representation using a type/subtype name.1

File extensions can suggest common media types, but an extension does not prove what the file contains. The calculation and input requirements are explained below.

When to use Mime Type Lookup

Enter an extension token, optionally with one leading dot.

How to use Mime Type Lookup and how it works

  1. Prepare the measurements or independently established model inputs described below, with matching units and observation scope.
  2. Enter the required fields and run Mime Type Lookup.
  3. Read the result fields using the formula, output units, signs and ordering explained below.
  4. Correct any rejected inputs and rerun; interpret the result within the stated model and its assumptions.
Input fieldMeaningValue typeRequirement
actualExtensionActual Extension. Use the units and matching context stated in the calculation below.stringRequired; other constraints below

Enter an extension token, optionally with one leading dot. Remove that dot and lowercase the remainder, requiring one or more ASCII letters or digits. Return the mapped media type from the ten-entry table, or empty text and found=false for an otherwise valid unknown extension. Whitespace, paths and compound dotted extensions fail this token grammar. No content sniffing occurs.

mimeType=inventory[normalizedExtension] or ''; found=inventoryContainsKey

Apply the input ordering, units and branch conditions stated above.

ExtensionMedia type
txttext/plain
htmltext/html
csstext/css
jstext/javascript
jsonapplication/json
pdfapplication/pdf
pngimage/png
jpgimage/jpeg
svgimage/svg+xml
wasmapplication/wasm
Output fieldMeaningValue type
resultObject containing the calculated or selected fields below.object
result.mimeTypeMime Type. Interpret its unit, sign, order or availability flag as explained above.string
result.foundInBoundedInventoryFound In Bounded Inventory. Interpret its unit, sign, order or availability flag as explained above.boolean
json
{
  "input": {
    "actualExtension": "json"
  },
  "output": {
    "result": {
      "mimeType": "application/json",
      "foundInBoundedInventory": true
    }
  }
}

Limitations and assumptions

The calculation uses the supplied observations and model inputs. It does not collect measurements, select a reference population or coefficient, or establish that the model applies to the actual case. The stated branch conditions and output units remain part of the result.

All fields require explicit values. Unexpected fields, wrong types, nonfinite numbers and sparse arrays are rejected. Alignment, bounds and supported-token rules are explained above; extremely large inputs or nonfinite results can also fail. Input errors differ from successful false comparisons, unavailable-domain flags and empty match lists.

Alternative or Complementary methods

Use Extension Lookup for a complementary operation: A media type may have several associated file extensions.

Use Content Encoding Detector for a complementary operation: Content-Encoding declares transformations applied to an HTTP representation, such as compression.

References

  1. Mime Type Lookup — tool.io

Similar or alternative tools

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies