# ext-name

> Get the file extension and MIME type from a file

Latest version **5.0.0** (published 2017-06-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install ext-name
pnpm add ext-name
yarn add ext-name
bun add ext-name
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2017-06-07 |
| First published | 2014-08-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 26 |
| Author | Kevin Mårtensson |
| Maintainers | kevva |
| Keywords | ext, extname, mime |

## Links

- npm: https://www.npmjs.com/package/ext-name
- Repository: https://github.com/kevva/ext-name
- Homepage: https://github.com/kevva/ext-name#readme
- Issues: https://github.com/kevva/ext-name/issues
- npm.io page: https://npm.io/package/ext-name

## Dependencies (2)

- [ext-list](https://npm.io/package/ext-list.md) ^2.0.0
- [sort-keys-length](https://npm.io/package/sort-keys-length.md) ^1.0.0

## Alternatives

- [ext-list](https://npm.io/package/ext-list.md) — 6.3M weekly downloads
- [@lexical/selection](https://npm.io/package/@lexical/selection.md) — 3.8M weekly downloads
- [@lexical/text](https://npm.io/package/@lexical/text.md) — 3.6M weekly downloads
- [@lexical/clipboard](https://npm.io/package/@lexical/clipboard.md) — 3.0M weekly downloads
- [@tiptap/extension-mention](https://npm.io/package/@tiptap/extension-mention.md) — 3.0M weekly downloads

## Recent versions

- 5.0.0 (latest) — 2017-06-07
- 4.1.0 — 2017-05-22
- 4.0.0 — 2016-05-21
- 3.0.0 — 2015-04-09
- 2.2.0 — 2015-04-09
- 2.0.2 — 2014-11-02
- 2.0.1 — 2014-10-28
- 2.0.0 — 2014-10-24
- 1.0.1 — 2014-08-31

## README

# ext-name [![Build Status](https://travis-ci.org/kevva/ext-name.svg?branch=master)](https://travis-ci.org/kevva/ext-name)

> Get the file extension and MIME type from a file


## Install

```
$ npm install --save ext-name
```


## Usage

```js
const extName = require('ext-name');

console.log(extName('foobar.tar'));
//=> [{ext: 'tar', mime: 'application/x-tar'}]

console.log(extName.mime('application/x-tar'));
//=> [{ext: 'tar', mime: 'application/x-tar'}]
```


## API

### extName(filename)

Returns an `Array` with objects with the file extension and MIME type.

#### filename

Type: `string`

Get the extension and MIME type from a filename.

### extName.mime(mimetype)

Returns an `Array` with objects with the file extension and MIME type.

#### mimetype

Type: `string`

Get the extension and MIME type from a MIME type.


## Related

* [ext-name-cli](https://github.com/kevva/ext-name-cli) - CLI for this module
* [file-type](https://github.com/sindresorhus/file-type) - Detect the file type of a Buffer/Uint8Array


## License

MIT © [Kevin Mårtensson](https://github.com/kevva)

---
_Source: https://npm.io/package/ext-name · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
