bytes to MB GB conversion

PHOTO EMBED

Sun Sep 24 2023 14:34:29 GMT+0000 (Coordinated Universal Time)

Saved by @StephenThevar #javascript

      const units = ["bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];

      function niceBytes(x) {
        let l = 0,
          n = parseInt(x, 10) || 0;
        while (n >= 1000 && ++l) {
          n = n / 1000;
        }
        return n.toFixed(n < 10 && l > 0 ? 1 : 0) + " " + units[l];
      }
content_copyCOPY

convert bytes to MB GB

https://stackoverflow.com/questions/15900485/correct-way-to-convert-size-in-bytes-to-kb-mb-gb-in-javascript