Binary Raw - Docs
    Preparing search index...

    Function formatSize

    • Formats a byte size to human-readable string.

      Parameters

      • bytes: number

      Returns string

      formatSize(42318)     → "42.3 KB"
      
      formatSize(1048576)   → "1.0 MB"
      
      formatSize(500)       → "500 B"
      
      formatSize(0)        → "0 B"