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

    Parameters

    • size: number

      The size in bytes.

    • Optional options: {
          decimalPlaces: number;
          base: 2 | 10;
      } = {}
      • decimalPlaces: number

        The number of decimal places to round to.

      • base: 2 | 10

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

    Returns string