Request: Add support for binary prefixes (KiB/MiB) in addition to decimal prefixes (KB/MB) #1

Open
fragmer opened this Issue Nov 18, 2013 · 3 comments

Projects

None yet

3 participants

@fragmer
fragmer commented Nov 18, 2013

It would be very useful to add an option to handle both binary prefixes (kibi/mebi/gibi/tebi/pebi) and decimal prefixes (kilo/mega/giga/tera/peta), for parsing and formatting.

@omar
Owner
omar commented Nov 19, 2013

I thought about adding support for this, however, I had a hard time thinking of a good API for it.

  1. I think it would warrant a rename of the class to something more generic like MemorySize, DataSize, or something better as I don't think the previous two really fit.
  2. This biggest change would be to the API to allow for easy access. Some options:
    • Create subtype (BitSize) that would properties for bits:
      • main.Bits.KiloBits
      • main.Bits.MegaBits,
    • Continue using the same class with additional properties
      • main.KiloBits
      • main.MegaBits
@JasonRitchie

Re: 1. Bytes and bits are used in both the decimal and binary space, so keeping the name ByteSize is not inaccurate.

@omar
Owner
omar commented Dec 1, 2016 edited

FYI, I started some work on this in 166ccbb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment