What is mimer?
The 'mimer' npm package is a utility for determining the MIME type of a file based on its extension. It is useful for applications that need to handle files and their types, such as web servers, file upload handlers, and content management systems.
What are mimer's main functionalities?
Determine MIME type from file extension
This feature allows you to get the MIME type of a file by providing its filename or extension. In this example, 'example.txt' returns 'text/plain'.
const mimer = require('mimer');
const mimeType = mimer('example.txt');
console.log(mimeType); // Output: 'text/plain'
Default MIME type for unknown extensions
If the file extension is not recognized, 'mimer' returns a default MIME type, which is 'application/octet-stream' in this case.
const mimer = require('mimer');
const mimeType = mimer('example.unknown');
console.log(mimeType); // Output: 'application/octet-stream'
Other packages similar to mimer
mime
The 'mime' package is a comprehensive MIME type utility that can look up MIME types based on file extensions and vice versa. It also allows for custom MIME type definitions. Compared to 'mimer', 'mime' offers more extensive functionality and a larger database of MIME types.
mime-types
The 'mime-types' package provides a similar functionality to 'mimer' but with a more extensive list of MIME types and additional features like looking up extensions based on MIME types. It is more feature-rich and widely used in the community.
mime-db
The 'mime-db' package is a database of MIME types mapped to file extensions. It is used by other packages like 'mime' and 'mime-types' to provide their functionality. While 'mime-db' itself is not a utility, it serves as the backbone for MIME type lookups in other packages.
Mimer
A simple MIME type getter built on top of Node.js.
MODULE
Browser version:: Minified (amd and CommonJS ready) Source
Node.js version: npm install mimer
into your project
Getting started
const Mimer = require('mimer');
require('path/to/mimer', function (Mimer) {});
window.Mimer
Get a MIME type
Mimer('file.css');
var mime = new Mimer();
mime.get('file.css');
Set a MIME type
var mime = new Mimer();
mime.set('.monster', 'movie/thriller')
.get('zombie.monster');
mime.set(['.rctycoon','.simcity'], 'cms/game');
mime.get('/land/park.rctycoon');
mime.get('maps/city.simcity');
CLIENT
npm install -g mimer
(it may require Root privileges)
pritting a mime type
$ mimer brand.png
DEVELOPING
$ make install
$ make test
Build web version with:
$ make build
If you'd like to test the full process including npm installer, just run:
$ make fulltest
Release notes
See more in Releases section.
License
MIT License
(c) Helder Santana