mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-07 13:15:59 +08:00
19 lines
647 B
TypeScript
19 lines
647 B
TypeScript
import * as mime from 'mime-types';
|
|
|
|
mime.lookup('json'); // 'application/json'
|
|
mime.lookup('.md'); // 'text/x-markdown'
|
|
mime.lookup('file.html'); // 'text/html'
|
|
mime.lookup('folder/file.js'); // 'application/javascript'
|
|
mime.lookup('folder/.htaccess'); // false
|
|
|
|
mime.lookup('cats'); // false
|
|
mime.contentType('markdown'); // 'text/x-markdown; charset=utf-8'
|
|
mime.contentType('file.json'); // 'application/json; charset=utf-8'
|
|
|
|
// from a full path
|
|
mime.contentType('.json'); // 'application/json; charset=utf-8'
|
|
|
|
mime.extension('application/octet-stream'); // 'bin'
|
|
|
|
mime.charset('text/x-markdown'); // 'UTF-8'
|