Socket
Socket
Sign inDemoInstall

ext-name

Package Overview
Dependencies
5
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ext-name

Get the file extension and MIME type from a file


Version published
Weekly downloads
3M
increased by2.22%
Maintainers
1
Install size
214 kB
Created
Weekly downloads
 

Readme

Source

ext-name Build Status

Get the file extension and MIME type from a file

Install

$ npm install --save ext-name

Usage

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.

  • ext-name-cli - CLI for this module
  • file-type - Detect the file type of a Buffer/Uint8Array

License

MIT © Kevin Mårtensson

Keywords

FAQs

Last updated on 07 Jun 2017

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