The desktop app has two size formatters and both are fixed to one unit:
function bytesToGB(n) {
return (n / 1e9).toFixed(2);
}
...used for every headline and group total, and (bytes / 1e6).toFixed(1)
" MB" for every row. So the numbers the app shows are:
| bytes |
headline |
row |
| 2 048 |
0.00 GB |
0.0 MB |
| 1 500 000 |
0.00 GB |
1.5 MB |
| 40 000 000 |
0.04 GB |
40.0 MB |
| 2 300 000 000 |
2.30 GB |
2300.0 MB |
A scan of a home directory that frees 40 MB reports 0.04 GB reclaimable,
every cache file under a megabyte reads 0.0 MB, and a 2.3 GB installer
is a four-digit MB number. "Understand your disk before you clean it"
should not need the reader to count decimal places.
The CLI already solved this — human_bytes in
crates/diskern-cli/src/main.rs, including the rounding detail that
prints 999 999 as 1.0 MB rather than 1000.0 KB. The app wants the same
function in JS, used everywhere a byte count is printed, so the two
frontends describe the same finding the same way.
Call sites: app/src/App.jsx:26 (bytesToGB), and the raw / 1e6 and
/ 1e9 at lines 94, 144, 181, 189, 190, 261, 361, 546.
The desktop app has two size formatters and both are fixed to one unit:
...used for every headline and group total, and
(bytes / 1e6).toFixed(1)" MB"for every row. So the numbers the app shows are:0.00 GB0.0 MB0.00 GB1.5 MB0.04 GB40.0 MB2.30 GB2300.0 MBA scan of a home directory that frees 40 MB reports
0.04 GB reclaimable,every cache file under a megabyte reads
0.0 MB, and a 2.3 GB installeris a four-digit MB number. "Understand your disk before you clean it"
should not need the reader to count decimal places.
The CLI already solved this —
human_bytesincrates/diskern-cli/src/main.rs, including the rounding detail thatprints 999 999 as
1.0 MBrather than1000.0 KB. The app wants the samefunction in JS, used everywhere a byte count is printed, so the two
frontends describe the same finding the same way.
Call sites:
app/src/App.jsx:26(bytesToGB), and the raw/ 1e6and/ 1e9at lines 94, 144, 181, 189, 190, 261, 361, 546.