(bytes: number)
| 6 | */ |
| 7 | |
| 8 | export const formatMemoryUsage = (bytes: number): string => { |
| 9 | const gb = bytes / (1024 * 1024 * 1024); |
| 10 | if (bytes < 1024 * 1024) { |
| 11 | return `${(bytes / 1024).toFixed(1)} KB`; |
| 12 | } |
| 13 | if (bytes < 1024 * 1024 * 1024) { |
| 14 | return `${(bytes / (1024 * 1024)).toFixed(1)} MB`; |
| 15 | } |
| 16 | return `${gb.toFixed(2)} GB`; |
| 17 | }; |