(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 | }; |
| 18 | |
| 19 | /** |
| 20 | * Formats a duration in milliseconds into a concise, human-readable string (e.g., "1h 5s"). |
no outgoing calls
no test coverage detected