mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-14 04:20:07 +02:00
[bugfix]: actually implement size column
This commit is contained in:
@@ -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]}`;
|
||||
};
|
||||
Reference in New Issue
Block a user