mimer

A simple Mime type getter

Mimer 1.0 released. See more in https://github.com/data-uri/mimer/releases/tag/v1.0.0
Last updated 8 years ago by helder .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install mimer 
SYNC missed versions from official npm registry.

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

Current Tags

  • 2.0.2                                ...           latest (5 years ago)

15 Versions

  • 2.0.2                                ...           5 years ago
  • 2.0.1                                ...           5 years ago
  • 2.0.0                                ...           5 years ago
  • 1.1.1                                ...           5 years ago
  • 1.1.0                                ...           6 years ago
  • 1.0.0                                ...           7 years ago
  • 0.3.2 [deprecated]           ...           8 years ago
  • 0.3.1 [deprecated]           ...           8 years ago
  • 0.3.0 [deprecated]           ...           8 years ago
  • 0.2.3 [deprecated]           ...           8 years ago
  • 0.2.2 [deprecated]           ...           8 years ago
  • 0.2.1 [deprecated]           ...           12 years ago
  • 0.2.0 [deprecated]           ...           12 years ago
  • 0.1.1 [deprecated]           ...           12 years ago
  • 0.1.0 [deprecated]           ...           13 years ago
Maintainers (1)
Downloads
Today 0
This Week 7
This Month 14
Last Day 1
Last Week 7
Last Month 3
Dependencies (0)
None
Dev Dependencies (5)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |