uploading files and a lot more

This commit is contained in:
Zoe
2024-09-08 07:15:43 -05:00
parent 13218116e3
commit 86ef860568
28 changed files with 1447 additions and 107 deletions

12
ui/utils/formatBytes.ts Normal file
View File

@@ -0,0 +1,12 @@
export function formatBytes(bytes: number, decimalPlaces = 2) {
if (bytes === 0) return '0 Bytes';
const k = 1024;
const dm = decimalPlaces;
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(dm)) + ' ' + sizes[i];
}