https://github.com/bcherny/content-type-to-ext
Map content-type to file extension (and vice-versa)
https://github.com/bcherny/content-type-to-ext
content-type extension file mime-type
Last synced: 9 months ago
JSON representation
Map content-type to file extension (and vice-versa)
- Host: GitHub
- URL: https://github.com/bcherny/content-type-to-ext
- Owner: bcherny
- Created: 2017-09-08T05:14:43.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-09-08T05:17:53.000Z (almost 9 years ago)
- Last Synced: 2025-10-08T21:07:52.529Z (9 months ago)
- Topics: content-type, extension, file, mime-type
- Language: TypeScript
- Size: 5.86 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# content-type-to-ext [![Build Status][build]](https://circleci.com/gh/bcherny/content-type-to-ext) [![npm]](https://www.npmjs.com/package/content-type-to-ext) [![mit]](https://opensource.org/licenses/MIT)
[build]: https://img.shields.io/circleci/project/bcherny/content-type-to-ext.svg?branch=master&style=flat-square
[npm]: https://img.shields.io/npm/v/content-type-to-ext.svg?style=flat-square
[mit]: https://img.shields.io/npm/l/content-type-to-ext.svg?style=flat-square
> Map Content-Type to file extension (and vice-versa)
## Installation
```sh
# Using Yarn:
yarn add content-type-to-ext
# Or, using NPM:
npm install content-type-to-ext --save
```
## Usage
```js
import { getContentType, getExtension } from 'content-type-to-ext'
getContentType('jpg') // image/jpeg
getExtension('image/jpeg') // jpg
```
## Tests
```sh
npm test
```
## License
MIT