XSnap is a JavaScript engine based on Moddable/XS. The algorithm below is orders of magnitude too slow on this VM, but it arranges a native binding on the global object. We use that if it is available instead.
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