naive-upload
Version:
<p align="left"> <a href="https://www.npmjs.org/package/naive-upload"> <img src="https://img.shields.io/npm/v/naive-upload.svg"> </a> <a href="https://bundlephobia.com/package/naive-upload@latest"> <img src="https://img.shields.io/bundl
31 lines (30 loc) • 739 B
JavaScript
var $ = Object.defineProperty;
var d = (r, t, a) => t in r ? $(r, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : r[t] = a;
var e = (r, t, a) => (d(r, typeof t != "symbol" ? t + "" : t, a), a);
const o = class {
static getSize(t, a = 1024, B = 2) {
if (t <= 0)
return "0 KB";
for (let f = 0; f < o.formats.length; f++) {
let m = t / Math.pow(a, f + 1);
if (m < a)
return `${m.toFixed(B)} ${o.formats[f]}`;
}
return `${(t / Math.pow(a, o.formats.length)).toFixed(B)} ${o.formats[o.formats.length - 1]}`;
}
};
let s = o;
e(s, "formats", [
"KB",
"MB",
"GB",
"TB",
"PB",
"EB",
"ZB",
"YB"
]);
export {
s as default
};
//# sourceMappingURL=FileSizeHelper.js.map