(bytes: number)
| 1 | export const formatFileSize = (bytes: number): string => { |
| 2 | if (bytes < 1024) return `${bytes} B`; |
| 3 | if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`; |
| 4 | if (bytes < 1024 * 1024 * 1024) |
| 5 | return `${(bytes / (1024 * 1024)).toFixed(1)} MB`; |
| 6 | return `${(bytes / (1024 * 1024 * 1024)).toFixed(2)} GB`; |
| 7 | }; |
| 8 | |
| 9 | export const formatDuration = (ms: number): string => { |
| 10 | if (ms < 1000) return `${ms}ms`; |
no outgoing calls
no test coverage detected