Skip to content

size format option 'kb' actually returns value in Kib  #102

@sushidub

Description

@sushidub

I'm sure nobody notices or cares, but it did actually throw me for a loop trying to chase down a separate db related issue.

The CLI docs for db say size_format flag can return optional values as follows:

$ wp help db size
  ...
  [--size_format]
    Display the database size only, as a bare number.
    ---
    default: b
    options:
     - b (bytes)
     - kb (kilobytes)
     - mb (megabytes)
     - gb (gigabytes)
     - tb (terabytes)
     ---

Goes on to show an example of returned values for options =b, =kb, =mb where the kb value actually seems to be reporting in kibibytes

Solution: Add footnote or short blurb in the doc mentioning the returned value for kb will report what might be slightly lower than expected since its factored by 1024 (not 1000)

1 KiB (Kibibyte) = 1,024 B (Bytes) (2^10 Bytes)
1 kb  (Kilobit)  =   125 B (Bytes) (10^3 Bits ÷ (8 bits / byte) = 125 B)
1 kB  (Kilobyte) = 1,000 B (Bytes) (10^3 Bytes)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions