synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
22 lines (21 loc) • 380 B
JavaScript
const l = [
"Bytes",
"KB",
"MB",
"GB",
"TB",
"PB",
"EB",
"ZB",
"YB"
];
function e(t, B = 2) {
if (t == null)
return "";
const o = Math.floor(Math.log(t) / Math.log(1024));
return t == 0 && "0 Bytes" || (t / Math.pow(1024, o)).toFixed(B) + " " + l[o];
}
export {
e as calculateFriendlyFileSize
};
//# sourceMappingURL=calculateFriendlyFileSize.js.map