Add meme-adding logic
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
33
src/utilities/filesystem.ts
Normal file
33
src/utilities/filesystem.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { MEME_TYPE } from '../database';
|
||||
|
||||
const allowedImageMimeTypes = [
|
||||
'image/bmp',
|
||||
'image/jpeg',
|
||||
'image/png',
|
||||
'image/webp',
|
||||
];
|
||||
|
||||
const allowedGifMimeTypes = ['image/gif'];
|
||||
|
||||
const allowedMimeTypes = [...allowedImageMimeTypes, ...allowedGifMimeTypes];
|
||||
|
||||
const getMemeType = (mimeType: string) => {
|
||||
switch (mimeType) {
|
||||
case 'image/bmp':
|
||||
case 'image/jpeg':
|
||||
case 'image/png':
|
||||
case 'image/webp': {
|
||||
return MEME_TYPE.IMAGE;
|
||||
}
|
||||
case 'image/gif': {
|
||||
return MEME_TYPE.GIF;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export {
|
||||
allowedImageMimeTypes,
|
||||
allowedGifMimeTypes,
|
||||
allowedMimeTypes,
|
||||
getMemeType,
|
||||
};
|
Reference in New Issue
Block a user