Skip to main content

File

File Size and Types

Storage Unit Constants

These constants is used for configuring you storage unit .These only constatns is for total storage capasity configuration and total used storage calculations.

src/config/file.ts
export const KB = 1000;
export const MB = KB * 1000;
export const GB = MB * 1000;

Maximum Sizes

You can also customize max upload size for your file and images with MAX_IMAGE_SIZE,MAX_FILE_SIZE these constants

src/config/file.ts
export const MAX_IMAGE_SIZE = 5 * MB;
export const MAX_FILE_SIZE = 4 * GB;

Image Types

You can configure your images types support from the file.ts file

src/config/file.ts
export const IMAGE_TYPES = [
'image/jpeg',
'image/jpg',
'image/png',
'image/webp',
'image/gif',
];

MIME Types

Configure your MIME type in the MIME

src/config/file.ts
export const MIME_TYPES = [
'image/jpeg',
'image/jpg',
'image/png',
'image/gif',
'image/webp',
'image/avif',
'image/svg+xml',
'image/vnd.microsoft.icon',
'text/*',
'application/pdf',
'application/json',
'application/x-abiword',
'application/x-freearc',
'application/vnd.oasis.opendocument.presentation',
'application/vnd.oasis.opendocument.spreadsheet',
'application/vnd.oasis.opendocument.text',
'application/msword',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/vnd.ms-powerpoint',
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'application/xlsx',
'application/vnd.ms-excel',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/zip',
'application/postscript',
'video/mp4',
'video/x-msvideo',
'video/mpeg',
'video/ogg',
'video/webm',
'video/3gpp',
'video/3gpp2',
'audio/mpeg',
'audio/ogg',
'audio/aac',
'audio/wav',
'audio/webm',
'audio/3gpp',
'audio/3gpp2',
'audio/midi',
'audio/x-midi',
];