(bytes: number)
| 242 | } |
| 243 | |
| 244 | const formatBytes = (bytes: number) => { |
| 245 | if (bytes === 0) return '0 Bytes' |
| 246 | const k = 1024 |
| 247 | const sizes = ['Bytes', 'KB', 'MB', 'GB'] |
| 248 | const i = Math.floor(Math.log(bytes) / Math.log(k)) |
| 249 | return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i] |
| 250 | } |
| 251 | |
| 252 | const formatSpeed = (bytesPerSecond: number) => { |
| 253 | return formatBytes(bytesPerSecond) + '/s' |
no outgoing calls
no test coverage detected