Function formatBytes

Formats the given number of bytes into a human-readable format.

If 'bytes' is not a positive integer.

  • Parameters

    • bytes: number

      The number of bytes to format.

    • Optionaldecimals: number = 2

      The number of decimal places to round the result to. Defaults to 2.

    Returns string

    The formatted string representing the number of bytes.