export function humanFileSize(size: number) { if (size < 1024) return `${size} B`; const i = Math.min(4, Math.floor(Math.log(size) / Math.log(1024))); return `${(size / 1024 ** i).toFixed(2)} ${["B", "KiB", "MiB", "GiB", "TiB"][i]}`; }