Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function humanSize(size, base = 1024, units = 'BKMGTPEZY') {
- const e = Math.log(size) / Math.log(base) | 0
- return `${(size / Math.pow(base, e)).toFixed(2)} ${units[e]}`
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement