goldies
    Preparing search index...

    Function formatBytes

    • Format bytes into a human-readable string with unit.

      Parameters

      • bytes: number

        The number of bytes to format.

      • separator: string = ' '

        The separator between the number and unit. Defaults to a space.

      Returns string

      The formatted string.

      // returns '1.0 MB'
      formatBytes(1048576)
      // returns '1.0-MB'
      formatBytes(1048576, '-')