Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default
✓ var getMimeType = require('simple-mime')('application/octet-stream')
✗ const mime = require('simple-mime')
The module exports a function that takes a fallback MIME type and returns a lookup function. Common mistake is to require the module without calling it.
lookup function
✓ var type = getMimeType('file.mp3')
✗ var type = getMimeType['mp3']
The returned function expects a filename or extension string. Do not treat it as an object with extension keys.
default export (ESM)
✓ import createMime from 'simple-mime'; const getMimeType = createMime('application/octet-stream')
✗ import { getMimeType } from 'simple-mime'
The package is primarily CJS, but some bundlers support ESM via default import. Named imports are incorrect.
Shows how to instantiate the mime lookup function with a fallback and query for different files.
var getMimeType = require('simple-mime')('text/plain');
console.log(getMimeType('file.html')); // 'text/html'
console.log(getMimeType('file.js')); // 'application/javascript'
console.log(getMimeType('file.xyz')); // 'text/plain' (fallback)
Errors
Common errors & fixes
TypeError: object is not a function
Requiring the module without calling it returns a function, not a lookup function.
fixChange require('simple-mime') to require('simple-mime')('application/octet-stream') Audit
Dependencies
No dependency data recorded yet.