RepoPilot

What units (KB, MB, GB...) does this support?

About sindresorhus/pretty-bytes · 2 messages · last activity 5/18/2026

Question

What units (KB, MB, GB...) does this support?

RepoPilot

The library supports multiple unit systems depending on the options used:

Standard Byte Units (default): B, kB, MB, GB, TB, PB, EB, ZB, YB [index.js:L1-L9]

Binary Byte Units (when binary: true): B, KiB, MiB, GiB, TiB, PiB, EiB, ZiB, YiB [index.js:L11-L19]

Bit Units (when bits: true): b, kbit, Mbit, Gbit, Tbit, Pbit, Ebit, Zbit, Ybit [index.js:L21-L29]

Binary Bit Units (when both bits: true and binary: true): b, kibit, Mibit, Gibit, Tibit, Pibit, Eibit, Zibit, Yibit [index.js:L31-L39]

The selection of which unit system to use is determined in the main function [index.js:L140-L143], where it picks the appropriate array based on the bits and binary options.

FOLLOW_UPS:

  • What's the difference between binary and non-binary formatting?
  • How does the library choose which unit to display?
  • Can I customize the units displayed?

Want to ask your own question?

Open chat for sindresorhus/pretty-bytes

Public Q&A. Generated by RepoPilot from the actual source of sindresorhus/pretty-bytes. AI answers can be incomplete or stale — verify before relying on them.