mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
better boris stats
This commit is contained in:
parent
be3401a4e5
commit
d35397108a
6 changed files with 132 additions and 3 deletions
|
@ -215,3 +215,11 @@ export const darken = (col: string, amt: number) => {
|
|||
|
||||
return (usePound ? '#' : '') + (g | (b << 8) | (r << 16)).toString(16);
|
||||
};
|
||||
|
||||
export const sizeOf = (bytes: number): string => {
|
||||
if (bytes == 0) {
|
||||
return '0.00 B';
|
||||
}
|
||||
var e = Math.floor(Math.log(bytes) / Math.log(1024));
|
||||
return (bytes / Math.pow(1024, e)).toFixed(2) + ' ' + ' KMGTP'.charAt(e) + 'B';
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue