Add basic file listing functionality

This commit is contained in:
Dane Everitt 2019-07-27 20:23:51 -07:00
parent ecb5384579
commit c90fcea519
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
7 changed files with 269 additions and 11 deletions

View 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]}`;
}