npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@produck/meta-apache-mime-extension

v0.1.0

Published

Apache httpd mime.types file extension mapping as static metadata for Node.js.

Readme

@produck/meta-apache-mime-extension

Apache httpd mime.types file extension mapping as static metadata for Node.js.

Why this source

No standards body maintains a mapping from media type to file extension. RFC 6838 states that file extensions are unreliable for determining a media type, so the IANA registry records no extensions at all.

The Apache httpd project maintains docs/conf/mime.types, which is used far beyond httpd itself. Its header states:

This file maps Internet media types to unique file extension(s). Although created for httpd, this file is used by many software systems and has been placed in the public domain for unlimited redistribution.

That combination, a maintained file, wide adoption, and public domain licensing, is why it is the source here. It is a de facto convention, not a standard, and the package presents it as such.

About the name

The source file is called mime.types, and the surrounding ecosystem (mime-db, mime-types) uses mime throughout, so mime-extension is the term most readers recognise. Note what the name does and does not claim: a file extension is not a property of a MIME type, it is a naming convention that is paired with one. This package just delivers that pairing as it is written in the Apache file.

Install

npm install @produck/meta-apache-mime-extension

Usage

The package root exports the snapshot provenance and the data namespace:

import { source, data } from '@produck/meta-apache-mime-extension';

source.commit; // commit the snapshot was taken from
source.snapshot; // permanent raw URL of that file
source.digest; // SHA-256 of the document in docs/reference.types

Every entry of data is keyed by its full media type, type/subtype, and contains a single extensionList export:

data['text/html'].extensionList; // ['html', 'htm']
data['application/json'].extensionList; // ['json']
data['image/jpeg'].extensionList; // ['jpeg', 'jpg', 'jpe']

Extensions carry no leading dot, matching the source file. A record exists only when the source declares at least one extension, so every entry has a non-empty list.

The package ships no aggregated list, no reverse index and no lookup API. Building an extension to media type index is the consumer's job.

Data shape

interface Source {
  project: string;
  url: string;
  snapshot: string;
  commit: string;
  collected: string;
  digest: string;
}

Every record exports exactly one field. The media type itself is the path you imported from, so repeating it inside the record would be redundant:

| Export | Type | | --------------- | ---------- | | extensionList | string[] |

Files

  • src/index.mjs — the source snapshot provenance.
  • src/data/index.mjs — one export * as '<type>/<subtype>' per record.
  • src/data/record/<type>/<subtype>.mjs — one record each.
  • docs/reference.types — the exact mime.types file the data came from.
  • docs/commit.txt — the commit that file was taken from.

docs/ is not part of the published package.

With sideEffects: false, downstream builds can import only the records they use.

Tree shaking

Subpath import. Each record has its own /<type>/<subtype> entry. Only the record you name ends up in the bundle:

import { extensionList } from '@produck/meta-apache-mime-extension/text/html';

Record level, statically. Import the record modules you need by path. Each import is a separate module, so the bundler keeps exactly the records you named:

import * as HTML from '@produck/meta-apache-mime-extension/text/html';
import * as JSON_TYPE from '@produck/meta-apache-mime-extension/application/json';

HTML.extensionList; // ['html', 'htm']
JSON_TYPE.extensionList; // ['json']

Whole registry. The root entry re-exports data, which re-exports every record. It is read at runtime, so a bundler cannot tell which entries you use: any enumeration pulls every record into the bundle.

import { data } from '@produck/meta-apache-mime-extension';

Object.keys(data); // every type/subtype key

Notes

  • Subpath names follow the source casing exactly. The mime.types file is lowercase throughout, so /text/html is the only valid import path. On case insensitive file systems a wrongly cased path silently resolves to the nearest existing record instead of failing.
  • The source lists some media types only as comments, meaning no unique extension. Those produce no record here.
  • One media type may carry several extensions. text/plain for instance maps to txt, text, conf, def, list, log and in, which reflects long-standing server convention rather than a standard.
  • This package does not merge with the IANA or WHATWG packages. It is an independent source; combining them is the consumer's decision.

License

MIT