@neonius/mime
v0.0.1
Published
Mime types
Downloads
2
Readme
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'