MCPcopy Create free account
hub / github.com/experdot/pointer / formatBytes

Function formatBytes

src/renderer/src/components/common/UpdateNotification.tsx:244–250  ·  view source on GitHub ↗
(bytes: number)

Source from the content-addressed store, hash-verified

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'

Callers 2

formatSpeedFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected