src/util/bytes.ts (view raw)
1 2 3 4 5
export const formatBytes = (n: number): string => { if (n >= 1_048_576) return `${(n / 1_048_576).toFixed(1)} MB`; if (n >= 1024) return `${(n / 1024).toFixed(1)} KB`; return `${n} B`; };