export function formatBytes(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`; } /** * A file's name as a readable dump title: the extension goes (it is noise in a * feed, and the dump already carries its MIME type), and separator runs become * spaces, so `holiday_photo-01.final.jpg` reads as `holiday photo-01.final`. * Names that are *only* an extension (`.gitignore`) are left alone. */ export function titleFromFileName(name: string): string { const withoutExt = name.replace(/(?!^)\.[^.]+$/, ""); return withoutExt.replace(/_+/g, " ").trim() || name; }