response/lib/mime-tpyes.js

72 lines
1.6 KiB
JavaScript

//
export const CHARSET_TYPES = {
html: 1,
txt: 1,
css: 1,
scss: 1,
xml: 1,
js: 1,
json: 1,
webmanifest: 1
}
export const MIME_TYPES = {
html: 'text/html',
xml: 'text/xml',
txt: 'text/plain',
css: 'text/css',
js: 'application/javascript',
json: 'application/json',
webmanifest: 'application/json',
wast: 'application/wast',
wasm: 'application/wasm',
gif: 'image/gif',
jpg: 'image/jpeg',
webp: 'image/webp',
tiff: 'image/tiff',
png: 'image/png',
apng: 'image/apng',
svg: 'image/svg+xml',
ico: 'image/x-icon',
bmp: 'image/x-ms-bmp',
mid: 'audio/midi',
midi: 'audio/x-midi',
mp3: 'audio/mpeg',
ogg: 'audio/ogg',
m4a: 'audio/x-m4a',
mp4: 'video/mp4',
webm: 'video/webm',
ttf: 'font/font-ttf',
woff: 'font/font-woff',
woff2: 'font/font-woff2',
zip: 'application/zip',
'7zip': 'application/zip',
rar: 'application/rar',
gz: 'application/x-gzip',
tar: 'application/x-tar',
tgz: 'application/x-tar',
pdf: 'application/pdf',
psd: 'application/x-photoshop',
doc: 'application/msword',
xls: 'application/vnd.ms-excel',
ppt: 'application/vnd.ms-powerpoint',
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
stream: 'application/octet-stream'
}
MIME_TYPES.vue = MIME_TYPES.js
MIME_TYPES.scss = MIME_TYPES.css
MIME_TYPES.htm = MIME_TYPES.html
MIME_TYPES.jpeg = MIME_TYPES.jpg
MIME_TYPES.tif = MIME_TYPES.tiff
对Http的response进一步封装, 提供常用的API
JavaScript 100%