Gregory Ballantine
f88eeafafa
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
22 lines
411 B
CoffeeScript
22 lines
411 B
CoffeeScript
@loadPage = (pagePath) ->
|
|
window.location.href = pagePath + '.html'
|
|
|
|
@formatBytes = (bytes, decimals = 2) ->
|
|
if bytes == 0
|
|
return '0 Bytes'
|
|
k = 1024
|
|
dm = if decimals < 0 then 0 else decimals
|
|
sizes = [
|
|
'Bytes'
|
|
'KB'
|
|
'MB'
|
|
'GB'
|
|
'TB'
|
|
'PB'
|
|
'EB'
|
|
'ZB'
|
|
'YB'
|
|
]
|
|
i = Math.floor(Math.log(bytes) / Math.log(k))
|
|
parseFloat((bytes / k ** i).toFixed(dm)) + ' ' + sizes[i]
|