mimer
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

Mimer Build Status install size

A file extension to MIME type module. Uses mime-db data but with zero dependencies.

Getting started

npm install mimer or npx mimer <file>.

Module

const mimer = require('mimer');

mimer('.pdf'); // -> "application/pdf"
mimer('pdf'); // -> "application/pdf"
mimer('../readme.pdf'); // -> "application/pdf"
mimer('pedefe'); // -> "application/octet-stream"

Extension Map

const mimer = require('mimer');
const mimerMap = require('mimer/map');

mimerMap.get('pdf'); // -> "application/pdf"
mimerMap.set('graphql', 'application/graphql');
mimer('content.graphql'); // -> "application/graphql"

Safe mode

In case you want to avoid changes on original Map for safety.

const mimer = require('mimer/safe');
const mimerMap = require('mimer/map');

mimerMap.set('graphql', 'application/graphql');
mimer('content.graphql'); // -> "application/octet-stream"

CLI

npm install -g mimer
mimer readme.pdf

or just

npx mimer readme.pdf

Contribute

Just create a new Github Codespace or:

$ git clone https://github.com/data-uri/mimer.git
$ cd mimer
$ npm i
$ npm test

Changelog.

License

MIT License (c) Helder Santana

Package Sidebar

Install

npm i mimer

Weekly Downloads

169,736

Version

2.0.2

License

MIT

Unpacked Size

44.5 kB

Total Files

9

Last publish

Collaborators

  • ruyadorno
  • helder
  • caiogondim