[bugfix]: actually implement size column

This commit is contained in:
Kendall Garner
2024-04-01 20:53:00 -07:00
parent 6bc778fa53
commit 2854a91700
16 changed files with 50 additions and 13 deletions
+12
View File
@@ -0,0 +1,12 @@
const SIZES = ['B', 'KiB', 'MiB', 'GiB', 'TiB'];
export const formatSizeString = (size: number): string => {
let count = 0;
let finalSize = size;
while (finalSize > 1024) {
finalSize /= 1024;
count += 1;
}
return `${finalSize.toFixed(2)} ${SIZES[count]}`;
};