Many inputs added

This commit is contained in:
2025-07-20 23:33:21 -04:00
parent f84f0a0ebc
commit cb8c2c23be
13 changed files with 335 additions and 16 deletions

9
lib/util/FileUtil.ts Normal file
View File

@@ -0,0 +1,9 @@
export function humanReadableBytes(bytes: number, decimals: number = 2): string{
if(bytes === 0){
return "0 Bytes";
}
const sizes = [ "Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" ];
const power = Math.floor(Math.log(bytes) / Math.log(1024));
return `${parseFloat((bytes / Math.pow(1024, power)).toFixed(decimals))} ${sizes[power]}`;
}