@neonius/mime

0.0.1 • Public • Published

Neonius module MIME

API

var mime = require('@neonius/mime')

mime.lookup(path)

Lookup the content-type associated with a file.

mime.lookup('file.html')   // 'text/html'
mime.lookup('file.js')     // 'application/javascript'

mime.lookup('file.112233') // null

mime.contentType(path)

Create a full content-type header given a content-type.

mime.contentType('file.md')   // 'text/markdown; charset=utf-8'
mime.contentType('file.json') // 'application/json; charset=utf-8'

mime.charset(charset)

Set charset for contentType function.

mime.charset('windows-1251')
mime.contentType('file.md')   // 'text/markdown; charset=windows-1251'

mime.extension(type)

Get the default extension for a content-type.

mime.extension('application/octet-stream') // '.bin'

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @neonius/mime

      Weekly Downloads

      2

      Version

      0.0.1

      License

      ISC

      Unpacked Size

      4.45 kB

      Total Files

      3

      Last publish

      Collaborators