» Import: units

The units import provides access to quick calculations for various byte units.

Note that this import uses base-2 terminology:

  • One kilobyte is 1024 bytes
  • One megabyte is 10242 = 1048576 bytes
  • One gigabyte is 10243 = 1073741824 bytes
  • One terabyte is 10244 = 1099511627776 bytes
  • One petabyte is 10245 = 1125899906842624 bytes

» units.kilobyte

The base-2 representation of a kilobyte (1024 bytes).

» units.megabyte

The base-2 representation of a megabyte (1048576 bytes).

» units.gigabyte

The base-2 representation of a gigabyte (1073741824 bytes).

» units.terabyte

The base-2 representation of a terabyte (1099511627776 bytes).

» units.petabyte

The base-2 representation of a petabyte (1125899906842624 bytes).