Achieve MIME Types
Created November 6, 2026 · Updated November 6, 2026 · Achieve 3.1.0 · Qualified runtime: Node.js 24.22.2
Achieve uses two MIME tables because resource class affects behavior as well as Content-Type. Ordinary entries use static-file handling; audiovisual entries use streaming and automatic byte-range handling.
Built-in mappings
The ordinary table includes HTML, CSS, JavaScript module variants, XML, SVG, JPEG, PNG, GIF, JSON, icon, XSLT, PDF, and plain text. The audiovisual table includes MP4, MPEG and Ogg video plus MPEG/MP3 and Ogg audio suffixes. Values are sent exactly as configured; Achieve does not append a charset to static MIME values.
Custom registration
achieve.addMimeType("pub", "application/x-mspublisher");
achieve.addAVMimeType("wav", "audio/wav");The leading dot is optional. Both arguments must be nonempty strings. Registration updates the selected table for later requests. Suffix matching is case-sensitive.
Protected and fallback suffixes
The .jss servlet suffix is reserved and cannot be registered as public static content; servlet module variants are executed rather than served. An existing ordinary static file whose suffix is in neither MIME table is served with Content-Type: text/plain. Achieve selects that fallback from the suffix lookup; it does not inspect the file bytes to infer another type.
Display and verification
showMimeTypes() enables startup display of both current tables without changing request handling. MIME, servlet-module, static, media-range, compression, and startup-reporting tests verify registered resource classes and their configured response types. The static-lookup regression also verifies that an existing file with an unregistered suffix returns 200, uses Content-Type: text/plain, and preserves its response bytes. Applications are responsible for choosing accurate custom media types and the correct ordinary or audiovisual class. See Content-Type and Media Types.
