-
Notifications
You must be signed in to change notification settings - Fork 1
/
mime.js
37 lines (36 loc) · 915 Bytes
/
mime.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var types = {
ogg: 'application/ogg',
mp3: 'audio/mpeg',
txt: 'text/plain',
nfo: 'text/plain; charset=cp850',
pdf: 'application/pdf',
svg: 'image/svg+xml',
jpeg: 'image/jpeg',
jpg: 'image/jpeg',
gif: 'image/gif',
png: 'image/png',
bmp: 'image/x-bmp',
mpg: 'video/mpeg',
mpeg: 'video/mpeg',
mp2: 'video/mpeg',
avi: 'video/x-msvideo',
wmv: 'video/x-ms-wmv',
wma: 'audio/x-ms-wma',
aac: 'audio/aac',
'3gp': 'audio/3gpp',
mov: 'video/quicktime',
mp4: 'video/mp4',
m4v: 'video/mp4',
mkv: 'video/x-matroska',
mks: 'video/x-matroska',
mka: 'audio/x-matroska',
asf: 'video/x-ms-asf',
ogv: 'video/ogg',
torrent: 'application/x-bittorrent'
};
module.exports = {
fileType: function(path) {
var ext = path.split('/').pop().split('.').pop();
return types[ext] || 'binary/octet-stream';
}
};