Skip to main content

utils.prettybytes.options.binary

Home > @nipem/utils > PrettyBytes > Options > binary

PrettyBytes.Options.binary property

Format the number using the Binary Prefix instead of the SI Prefix. This can be useful for presenting memory amounts. However, this should not be used for presenting file sizes.

Signature:
readonly binary?: boolean;

Example

import { prettyBytes } from '@nipem/utils';
P(1000, {binary: true});
//=> '1000 bit'
P(1024, {binary: true});
//=> '1 kiB'