Add basic file listing functionality
This commit is contained in:
parent
ecb5384579
commit
c90fcea519
7 changed files with 269 additions and 11 deletions
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]}`;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue