UNPKG

@codex-storage/marketplace-ui-components

Version:
12 lines (11 loc) 325 B
const n = (t) => { const r = ["bytes", "KB", "MB", "GB", "TB"]; if (t == 0) return "0 b"; const o = parseInt(Math.floor(Math.log(t) / Math.log(1024)).toString()); return o == 0 ? t + " " + r[o] : (t / Math.pow(1024, o)).toFixed(1) + " " + r[o]; }; export { n as PrettyBytes }; //# sourceMappingURL=bytes.js.map