• Easily convert between storage size units.

    NOTICE: we use base 10 instead of base 2 for bit

    Parameters

    Returns number

    See

    [IEC 60027-2 A.2 and ISO/IEC 80000]https://en.wikipedia.org/wiki/Binary_prefix#IEC_prefixes

    Example

    byteSize('1.5KB') === 12_000
    byteSize(32_000_000) === '4 MB'
    byteSize(byteSize('32 Gigabytes')) === '32 GB'
  • Parameters

    • value: number

    Returns string