UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

22 lines (21 loc) 380 B
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