Encodes a UTF-8 string as a data: URI with the given MIME type.
Minifies SVG whitespace when mimeType is "image/svg+xml".
UTF-8 string to encode.
MIME type for the resulting data URI; SVG payloads are whitespace-minified first.
A data:${mimeType};base64,... URI.
Encodes a UTF-8 string to raw base64 text. Supports Unicode input.
Uses the fastest available method:
Buffer(Node.js)Uint8Array.toBase64(modern browsers)TextEncoder+btoa(legacy fallback)