mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-20 11:26:13 +00:00
opnsense/core: fix file size suffix (#3379)
This commit is contained in:
parent
cec76910b4
commit
e43e8edab6
@ -41,7 +41,7 @@
|
||||
decimals = 0;
|
||||
}
|
||||
const kb = 1024;
|
||||
const ndx = Math.floor(Math.log(bytes) / Math.log(kb));
|
||||
const ndx = bytes === 0 ? 0 : Math.floor(Math.log(bytes) / Math.log(kb));
|
||||
const fileSizeTypes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
|
||||
return (bytes / Math.pow(kb, ndx)).toFixed(decimals) + ' ' + fileSizeTypes[ndx];
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user