9 lines
459 B
TypeScript
9 lines
459 B
TypeScript
export const MAX_ATTACHMENT_BYTES = 20 * 1024 * 1024;
|
|||
|
|
export const MAX_ATTACHMENTS = 10;
|
||
|
|
export const STAGED_ATTACHMENT_TTL_MS = 24 * 60 * 60 * 1000;
|
||
|
|
export type Attachment = { id: string; name: string; size: number; createdAt: string };
|
||
|
|
export function formatFileSize(bytes: number): string {
|
||
|
|
if (bytes < 1024) return `${bytes} B`;
|
||
|
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
||
|
|
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
||
|
|
}
|