Add a size format method for converting Numbers to automatic byte units

Original GH Issue

The purpose of this method is to make it easy for devs to automatically convert any numeric value (Numbers, BigInts, maybe even Decimals) to a string representing a binary data size/length/count, and being able to choose any standard system like SI or IEC (and maybe more in the future).

This S.O. question (and its comments) show how hard it is to get the implementation right, and the number of views and upvotes shows how useful such a function would be (yes, I'm aware I may have committed a fallacy).

JS code is often used to deal with files (or just data in general), and many times it is necessary to display statistics about the data in a user-friendly manner

Related: Automatic unit conversion for Intl.NumberFormat

2 Likes

Thank you for the link. I couldn't find a related post