mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 02:13:33 +00:00
[bugfix]: actually implement size column
This commit is contained in:
parent
6bc778fa53
commit
2854a91700
16 changed files with 50 additions and 13 deletions
12
src/renderer/utils/format-size-string.ts
Normal file
12
src/renderer/utils/format-size-string.ts
Normal 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]}`;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue