Initial commit.
This commit is contained in:
commit
b48a4e92e1
169 changed files with 7538 additions and 0 deletions
34
lib/type.js
Normal file
34
lib/type.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
const extensions = {
|
||||
'jpg': 'image',
|
||||
'jpeg': 'image',
|
||||
'png': 'image',
|
||||
'gif': 'image',
|
||||
'bmp': 'image',
|
||||
'tiff': 'image',
|
||||
'psd': 'image',
|
||||
'mp3': 'audio',
|
||||
'm4a': 'audio',
|
||||
'ogg': 'audio',
|
||||
'flac': 'audio',
|
||||
'aac': 'audio',
|
||||
'mpg': 'video',
|
||||
'mkv': 'video',
|
||||
'avi': 'video',
|
||||
'divx': 'video',
|
||||
'mpeg': 'video',
|
||||
'flv': 'video',
|
||||
'mp4': 'video',
|
||||
'mov': 'video',
|
||||
'zip': 'archive',
|
||||
'gz': 'archive',
|
||||
'tgz': 'archive',
|
||||
'bz2': 'archive',
|
||||
'rar': 'archive'
|
||||
};
|
||||
|
||||
export function sniff(filename) {
|
||||
if (extensions[filename.split('.').pop().toLowerCase()]) {
|
||||
return extensions[filename.split('.').pop().toLowerCase()];
|
||||
}
|
||||
return 'other';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue