(bytes: number)
| 101 | } |
| 102 | |
| 103 | function formatBytes(bytes: number): string { |
| 104 | if (bytes < 1024) return `${bytes} B`; |
| 105 | const kib = bytes / 1024; |
| 106 | if (kib < 1024) return `${kib.toFixed(1)} KiB`; |
| 107 | const mib = kib / 1024; |
| 108 | if (mib < 1024) return `${mib.toFixed(1)} MiB`; |
| 109 | return `${(mib / 1024).toFixed(1)} GiB`; |
| 110 | } |
no outgoing calls
no test coverage detected