pdf-lite - v1.0.1
    Preparing search index...

    Function stringToBytes

    • Converts a string or byte array to a byte array using UTF-8 encoding. If the input is already a byte array, it is returned as-is.

      Parameters

      • str: string | ByteArray

        The string or byte array to convert.

      Returns ByteArray

      The input as a byte array.

      stringToBytes('Hello') // Returns Uint8Array([72, 101, 108, 108, 111])