ConstPure-JavaScript base64 encoder, exported for benchmarking and for
environments where the native TC39 Uint8Array.prototype.toBase64
intrinsic (proposal-arraybuffer-base64) is unavailable or has been
removed.
See encodeBase64 below for the dispatched default.
XSnap, a JavaScript engine based on Moddable/XS, runs this polyfill
orders of magnitude slower than V8.
Older XS builds expose a native globalThis.Base64 binding that the
dispatched encodeBase64 uses ahead of the polyfill on legacy
Agoric chain XS; going forward, XS is expected to favor the standard
Uint8Array.prototype.toBase64.
This function is exported from this file for use in benchmarking, but is not part of the module's public API.
base64 encoding
Encodes bytes into a Base64 string, as specified in https://tools.ietf.org/html/rfc4648#section-4.
Dispatches to the native
Uint8Array.prototype.toBase64intrinsic when available (stage-4 TC39 proposal-arraybuffer-base64). Otherwise falls through to the legacyglobalThis.Base64.encodeXS binding, and finally to the pure-JavaScriptjsEncodeBase64.