Fix #1 files less than 1KB showing as negative

This commit is contained in:
Mahdi Dibaiee 2015-09-16 17:52:52 +04:30
parent b2b71b5d10
commit d0c8c91250

View File

@ -39,13 +39,13 @@ const sizes = {
'GB': Math.pow(2, 30),
'MB': Math.pow(2, 20),
'KB': Math.pow(2, 10),
'B': -1
'B': 0
}
export function humanSize(size) {
for (let key in sizes) {
let value = sizes[key];
if (size > value) {
if (size >= value) {
return Math.round(size / value) + key;
}
}