The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | export function formatBytes(bytes: number): string { |
| 2 | if (bytes < 1024) return `${bytes} B`; |
| 3 | if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(bytes < 10 * 1024 ? 1 : 0)} KB`; |
| 4 | if (bytes < 1024 ** 3) |
| 5 | return `${(bytes / (1024 * 1024)).toFixed(bytes < 10 * 1024 * 1024 ? 1 : 0)} MB`; |
| 6 | return `${(bytes / 1024 ** 3).toFixed(1)} GB`; |
| 7 | } |