Skip to content

A library for getting MIME types from extensions and vice versa.

License

Notifications You must be signed in to change notification settings

hexrw/ext-mime-map

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Extension to MIME type & MIME type to extension

This module provides a map of MIME types to file extensions.

Usage

// ES6

import mimeExtMap from "ext-mime-map"

mimeExtMap(".js")  // text/javascript
mimeExtMap("application/octet-stream")  // [ ".a", ".bin", ".bpk", ".deploy", ".dist", ".distz", ".dmg", ".dms",  ".dump", ".elc", ".iso", ".lha", ".lrf", ".lzh", ".o", ".obj", ".pkg", ".so" ]
mimeExtMap("application/json")  // .json
mimeExtMap("application/zip")  // .zip
mimeExtMap("application/x-zip-compressed")  // "" (not found)

Note: When searching for MIME type by file extension, the extension must start with a dot. For example, .js and not js.

For more complicated use cases you can use map.json - a JSON map of MIME types to file extensions.

About

A library for getting MIME types from extensions and vice versa.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published