Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. var bytesToSize = function (a, b) {
  2. if (0 === a) return "0 Bytes";
  3. var c = 1024, d = b || 2, e = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"],
  4. f = Math.floor(Math.log(a) / Math.log(c));
  5. return parseFloat((a / Math.pow(c, f)).toFixed(d)) + " " + e[f]
  6. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement