Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.17 KB | None | 0 0
  1. function humanSize(size, base = 1024, units = 'BKMGTPEZY') {
  2. const e = Math.log(size) / Math.log(base) | 0
  3. return `${(size / Math.pow(base, e)).toFixed(2)} ${units[e]}`
  4. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement