@devries-cameron20 / t3code Mirror · read-only
Fork 0

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

main
ts 7 lines 349 Bytes
Raw
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 }