Private
Public Access
Lists files and images actually attached to sent messages in a room, newest first, with click-through to a lightbox, preview modal, or direct download depending on type. Queries through messages.image_id/file_id so an upload that was never sent doesn't show up as a phantom entry. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
6 lines
218 B
TypeScript
6 lines
218 B
TypeScript
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`
|
|
}
|