mediawiki.inspect.js has a function humanSize, mediawiki.special.upload.js a function prettySize, UW probably has such a function, and there will be several other implementations of it, including user scripts and gadgets. Instead of re-inventing the wheel every time there should be a module for this, or a function in an already existing module.
Version: 1.23.0
Severity: enhancement