Created
February 3, 2021 19:36
-
-
Save K-Francis-H/8b112e9740141c808287269da6ba4b74 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function prettySize(bytes){ | |
| let index = 0; | |
| let suffixes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; | |
| while(bytes > 1000){ | |
| bytes = bytes/1000; | |
| index++; | |
| } | |
| return bytes.toFixed(2)+suffixes[index]; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment