import { formatBytes } from "https://deno.land/x/pup@1.0.0-rc.5/plugins/web-interface/static/js/helpers.js";
Converts the given bytes into a string with a unit. The units used are Bytes, KB, MB, GB and TB. The conversion is made to the smallest unit for which the value is greater than or equal to 1.
Examples
// returns "975 KB"
formatBytes(1000000);
// returns "975 KB" formatBytes(1000000);
// returns "0 Bytes"
formatBytes(0);
// returns "0 Bytes" formatBytes(0);
// returns "4.67 GB"
formatBytes(5000000000);
// returns "4.67 GB" formatBytes(5000000000);