Extension Lookup

Bounded off line10common MIME type→preferred extension inventory; optional parameters ignored, not all valid alternate extensions or MIME security/content verification.

Description

A media type may have several associated file extensions.

A media type may have several associated file extensions.1

A preferred extension helps label a file, while the actual bytes and required format still need to match that label. The calculation and input requirements are explained below.

When to use Extension Lookup

Enter a media type.

How to use Extension 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 Extension 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
actualMimeTypeActual Mime Type. Use the units and matching context stated in the calculation below.stringRequired; other constraints below

Enter a media type. Keep the portion before the first semicolon, trim it and lowercase it; validate the implementation's simple type/subtype token grammar. Return the preferred extension from the ten-entry table, or empty text and found=false for an unknown valid token. Parameters are ignored rather than parsed or validated, and alternative extensions are not enumerated.

preferredExtension=inventory[normalizedTypeSubtype] 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.preferredExtensionPreferred Extension. 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": {
    "actualMimeType": "application/json"
  },
  "output": {
    "result": {
      "preferredExtension": "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 Mime Type Lookup for a complementary operation: A media type describes a file or representation using a type/subtype name.

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

References

  1. Extension Lookup — tool.io

Similar or alternative tools

  • Mime Type Lookup

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

  • Content Encoding Detector

    Content-Encoding declares transformations applied to an HTTP representation, such as compression.

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