fix(utils): correct byte formatting boundaries for rounding
WHY/WHAT
Fixed non-intuitive unit rounding for byte formatting. Previously, values close to a unit boundary (e.g. 999,999 B) displayed incorrectly as the smaller unit. We adjusted the conversion threshold (e.g. to 999,950 B for MB) to leverage standard toFixed(1) rounding, ensuring values that are almost 1.0 of the next unit are correctly displayed as 1.0 MB, prioritizing a better user experience.
Why was this only done for two of the units?
This fix prevents inconsistencies caused by toFixed(1) rounding.
e.g. preventing 999.95 from displaying as "1000.0".
Why was this only done for two of the units?
- kB → MB / MB → GB (Fixed): Previously, 999,950 bytes (999.95 kB) rounded up to 1000.0 kB. I lowered the threshold to ensure these values switch to the next unit (e.g., 1.0 MB) instead.
- Bytes → kB (No fix): Bytes are integers (999 B → 1000 B), so fractional rounding issues do not occur.
- GB → TB (No fix): The current logic only supports up to GB, so no upper transition exists.
rebase on the latest and added the tests to tar as suggested