CoAgent8 - Source API
    Preparing search index...

    Function truncateToByteLength

    • Truncates a UTF-8 string to a maximum byte length without splitting multi-byte characters. Guarantees that the resulting string's UTF-8 byte length NEVER exceeds maxBytes.

      Parameters

      • str: string
      • maxBytes: number
      • suffix: string = '...[truncated]'

      Returns string