Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Humanize: my first open source package, mostly a rewrite.
humanize.filesize(1234567890); // '1.15 Gb'
And, you might want to let the user choose between decimal or binary prefixes (rather than the 'kilo' redefinition).
1234567890 bytes is 1.23 GB in pedantic application of SI naming, as used by MacOS and Ubuntu GUIs after a certain point.
1234567890 bytes is 1.15 GiB by the IEC standard for base-2 units, which is also "1.15 GB" by the older we-hope-context-makes-things-clear tradition.
See the approach of python humanize for one way to parameterize the output:
http://pypi.python.org/pypi/humanize
And see the Ubuntu Units Policy for some reasonable suggestions for when to use which kinds of units:
https://wiki.ubuntu.com/UnitsPolicy
There are no comments on this comment yet.
And, you might want to let the user choose between decimal or binary prefixes (rather than the 'kilo' redefinition).
1234567890 bytes is 1.23 GB in pedantic application of SI naming, as used by MacOS and Ubuntu GUIs after a certain point.
1234567890 bytes is 1.15 GiB by the IEC standard for base-2 units, which is also "1.15 GB" by the older we-hope-context-makes-things-clear tradition.
See the approach of python humanize for one way to parameterize the output:
http://pypi.python.org/pypi/humanize
And see the Ubuntu Units Policy for some reasonable suggestions for when to use which kinds of units:
https://wiki.ubuntu.com/UnitsPolicy