• Format a file size to an appropriate order of magnitude.

    Parameters

    • size: number

      The size in bytes.

    • Optionaloptions: { base?: 2 | 10; decimalPlaces?: number } = {}
      • Optionalbase?: 2 | 10

        The base to use. In base 10 a kilobyte is 1000 bytes. In base 2 it is 1024 bytes.

      • OptionaldecimalPlaces?: number

        The number of decimal places to round to.

    Returns string