-
Notifications
You must be signed in to change notification settings - Fork 0
Home
uupaa edited this page Mar 30, 2016
·
5 revisions
MimeType.js は、ファイルの拡張子に対応する MimeType を返すライブラリです。
ブラウザ上で多用される MimeType を中心にサポートしています。
サポートしている MimeTypeの一覧 も参照してください。
// 拡張子からMimeTypeを取得します
MimeType.getMimeType("js") // -> "application/javascript"
MimeType.getMimeType("json") // -> "application/json"
MimeType.getMimeType(".json") // -> "application/json"
MimeType.getMimeType(".JSON") // -> "application/json"
// MimeType がフォント系なら true を返します
MimeType.isFont("ttf") // -> true
// MimeType が画像系なら true を返します
MimeType.isImage("gif") // -> true
// MimeType が音声系なら true を返します
MimeType.isAudio("m4a") // -> true
// MimeType が映像系なら true を返します
MimeType.isVideo("mp4") // -> true
// MimeType がテキスト系なら true を返します
MimeType.isText("txt") // -> true
MimeType.isText("css") // -> true
MimeType.isText("html") // -> true
MimeType.isText(".HTML") // -> true