mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-07 15:33:50 +08:00
fix hound
This commit is contained in:
parent
f00c36998d
commit
f12a645fa3
1 changed files with 1 additions and 1 deletions
|
@ -5,5 +5,5 @@ export function formatBytes(bytes: number): string {
|
||||||
const k = 1024;
|
const k = 1024;
|
||||||
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));
|
||||||
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
|
return `${parseFloat((bytes / (k ** i)).toFixed(2))} ${sizes[i]}`;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue