Somsubhra / github-release-stats

Get the latest release stats of your project on Github
https://somsubhra.github.io/github-release-stats/
MIT License
523 stars 85 forks source link

File size reported incorrectly #12

Closed KerryL closed 7 years ago

KerryL commented 7 years ago

File size is reported in "MB" which I expected to mean megabytes. Instead, it is actually millions of bytes. Since there are 1024 bytes in a kB and 1024 kB in a MB, the correct size in megabytes is the number of bytes divided by 1048576.

PhrozenByte commented 7 years ago

This is a false bugreport @KerryL!

1 MB (Megabyte) = 1,000 kB (Kilobyte) = 1,000,000 Byte - i.e. power of 10, e.g. 1 MB is 10^3 kB or 10^6 Byte. Tera, Giga, Mega and Kilo are so-called SI prefixes, which are uniformly defined worldwide for measurement (mass, volume, length...).

You're in contrast talking about the so-called binary prefixes Kibi (KiB), Mebi (MiB), Gigi (GiB) and Tebi (TiB): 1 MiB (Mebibyte) = 1,024 KiB (Kibibyte) = 1,048,576 Byte - i.e. power of 2, e.g. 1 MiB is 2^10 KiB or 2^20 Byte

It's correct that especially Windows uses prefixes wrong for centuries, that's the reason why customers buying a hard drive are often confused why their 1 TB HDD seems to be just 931 GB large. That's because Windows uses the wrong prefix: It should be 931 GiB. Windows is a exception here, all other operating systems (like OS X, Linux, iOS or Android) use either the SI prefixes or binary prefixes correctly.

Personally I don't care whether you want to use SI prefixes or binary prefixes @Somsubhra, however, this way it is simply wrong. Thus you should either revert 23158d0 or change the unit to MiB instead of MB. btw: There's a space missing before the unit.

KerryL commented 7 years ago

Well I just learned something new!

I first noticed this because GitHub reports the size of these files using megabytes, and it was different from what was reported on the statistics page. And GitHub chose to use "MB."

I'll leave the decision about how to proceed to @Somsubhra but if you really wanted to be technically correct I would prefer to see "MiB" rather than going back to "millions of bytes."