Skip to content

The app prints every size in GB, so most findings read 0.00 GB #83

Description

@Muawiya-contact

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appThe Tauri desktop appbugSomething isn't workinggood first issueGood for newcomersjavascriptPull requests that update javascript codelevel: beginnerSmall and well-scoped; no deep context neededpriority: mediumWorth doing, not urgent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions