Fix byte conversion

This commit is contained in:
Rasmus Krämer 2023-07-19 23:59:00 +02:00 committed by GitHub
parent 24b9ac6a68
commit 38596d017f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,7 +83,7 @@ function bytesPretty(bytes, decimals = 0) {
if (bytes === 0) { if (bytes === 0) {
return '0 Bytes' return '0 Bytes'
} }
const k = 1024 const k = 1000
var dm = decimals < 0 ? 0 : decimals var dm = decimals < 0 ? 0 : decimals
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
const i = Math.floor(Math.log(bytes) / Math.log(k)) const i = Math.floor(Math.log(bytes) / Math.log(k))