Encodes bytes as base64, standard or URL-safe.
The bytes to encode.
urlSafe swaps the alphabet to -/_; pad controls = padding (defaults to padded for standard base64 and unpadded for URL-safe, the usual conventions).
urlSafe
-
_
pad
=
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' Copy
import { toBase64 } from 'edgeport/util';toBase64(new TextEncoder().encode('hi>?')); // 'aGk+Pw=='toBase64(new TextEncoder().encode('hi>?'), { urlSafe: true }); // 'aGk-Pw'
Encodes bytes as base64, standard or URL-safe.