edgeport - v1.0.3
    Preparing search index...

    Function toBase64

    • Encodes bytes as base64, standard or URL-safe.

      Parameters

      • bytes: Uint8Array

        The bytes to encode.

      • opts: Base64Options = {}

        urlSafe swaps the alphabet to -/_; pad controls = padding (defaults to padded for standard base64 and unpadded for URL-safe, the usual conventions).

      Returns string

      The base64 string.

      1.0.3

      import { toBase64 } from 'edgeport/util';

      toBase64(new TextEncoder().encode('hi>?')); // 'aGk+Pw=='
      toBase64(new TextEncoder().encode('hi>?'), { urlSafe: true }); // 'aGk-Pw'