mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-23 00:33:46 +02:00
Add basic file listing functionality
This commit is contained in:
6
resources/scripts/helpers.ts
Normal file
6
resources/scripts/helpers.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
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]}`;
|
||||
}
|
||||
Reference in New Issue
Block a user