Merge pull request #75 from motdde/bugfix/strings.byteToSize

Bugfix: strings.bytesToSize method returns inaccurate decimal places
This commit is contained in:
CAKE 2020-07-19 18:44:16 -07:00 committed by GitHub
commit 920fd2ef6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,7 +49,7 @@ export const bytesToSize = (bytes, decimals = 2) => {
const i = Math.floor(Math.log(bytes) / Math.log(k)); const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i]; return `${(bytes / Math.pow(k, i)).toFixed(dm)} ${sizes[i]}`;
}; };
export const getRemainingTime = (seconds) => { export const getRemainingTime = (seconds) => {