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 formatSize(size) { | |
| const base = 1000; // 1000 or 1024 | |
| const kb = base ** 1; | |
| const mb = base ** 2; | |
| const gb = base ** 3; | |
| let num; | |
| num = (size / 1).toFixed(0); | |
| if (num < base) return Number(num) + ' B'; |