Add support for showing usage graphs on the console page

This commit is contained in:
Dane Everitt 2019-09-29 13:23:15 -07:00
parent c66d2cd123
commit 29834a33f8
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
7 changed files with 292 additions and 52 deletions

View file

@ -4,7 +4,8 @@ export function bytesToHuman (bytes: number): string {
}
const i = Math.floor(Math.log(bytes) / Math.log(1000));
// @ts-ignore
return `${(bytes / Math.pow(1000, i)).toFixed(2) * 1} ${['Bytes', 'kB', 'MB', 'GB', 'TB'][i]}`;
}
export const bytesToMegabytes = (bytes: number) => Math.floor(bytes / 1000 / 1000);