mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-11-29 19:36:31 -05:00
move about page to own vue component
This commit is contained in:
parent
1afc434d86
commit
fcb07bcdae
3 changed files with 148 additions and 81 deletions
21
src/frontend/js/Utils.js
Normal file
21
src/frontend/js/Utils.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
class Utils {
|
||||
|
||||
static formatBytes(bytes) {
|
||||
|
||||
if(bytes === 0){
|
||||
return '0 Bytes';
|
||||
}
|
||||
|
||||
const k = 1024;
|
||||
const decimals = 0;
|
||||
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||||
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
|
||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(decimals)) + ' ' + sizes[i];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default Utils;
|
||||
Loading…
Add table
Add a link
Reference in a new issue