Migrate paths dashboard widget to react and add storage metrics

This commit is contained in:
Bill Thornton
2025-06-03 16:28:22 -04:00
parent a938650ded
commit 09063d3376
11 changed files with 322 additions and 81 deletions
+8
View File
@@ -28,3 +28,11 @@ export function readFileAsText(file: File): Promise<string> {
reader.readAsText(file);
});
}
/** Gets a human readable string representing a file size in bytes */
export function getReadableSize(value: number, precision = 1) {
let d = Math.log(value) / Math.log(1024) | 0;
return (value / Math.pow(1024, d)).toFixed(precision)
+ ' ' + (d ? 'KMGTPEZY'[--d] + 'iB' : 'Bytes');
}