Socket
Socket
Sign inDemoInstall

mimer

Package Overview
Dependencies
0
Maintainers
3
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mimer

A simple Mime type getter


Version published
Weekly downloads
232K
decreased by-0.41%
Maintainers
3
Install size
44.3 kB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 22 Aug 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc