This repository has been archived on 2025-07-31. You can view files and clone it, but cannot push or open issues or pull requests.
Files
terminally-online/src/utilities/filesystem.ts
2023-07-26 16:10:45 +03:00

34 lines
640 B
TypeScript

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): MEME_TYPE | undefined => {
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,
};