Blockchain Commons Components TypeScript Library - v1.0.0-alpha.13
    Preparing search index...

    Function toBase64

    • Convert a Uint8Array to a base64-encoded string.

      This function works in both browser and Node.js environments. Uses btoa which is available in browsers and Node.js 16+.

      Parameters

      • data: Uint8Array

        The byte array to encode

      Returns string

      A base64-encoded string

      const bytes = new Uint8Array([72, 101, 108, 108, 111]); // "Hello"
      toBase64(bytes); // "SGVsbG8="