@sidewinder/mime
v0.14.0
Published
Sidewinder Mime
Downloads
66
Readme
Overview
This package contains a mime type lookup utility.
License MIT
Example
The Mime utility provides a single lookup function that accepts a path or filename and returns an default mime type. If the lookup function cannot resolve the mime type, it will return a default of application/octet-stream
.
import { Mime } from '@sidewinder/mime'
const mime0 = Mime.lookup('directory/file.txt') // 'text/plain'
const mime1 = Mime.lookup('directory/file.xml') // 'application/xml'
const mime2 = Mime.lookup('directory/file.json') // 'application/json'
const mime3 = Mime.lookup('directory/file.png') // 'image/png'
const mime3 = Mime.lookup('directory/file.mp4') // 'video/mp4'