(bytes: number)
| 164 | } |
| 165 | |
| 166 | function formatSize(bytes: number): string { |
| 167 | if (bytes < 1024) return `${bytes} B`; |
| 168 | if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`; |
| 169 | if (bytes < 1024 * 1024 * 1024) return `${(bytes / 1024 / 1024).toFixed(1)} MB`; |
| 170 | return `${(bytes / 1024 / 1024 / 1024).toFixed(2)} GB`; |
| 171 | } |