Encodes data as a Base64-encoded Data URL string.
encodeDataURL(data, type?)
data
An Asset, Blob, File, ArrayBuffer, or Uint8Array containing bytes to encode.
type optional
A Media Type string.
If data is an Asset, Blob, or File, defaults to the type from it.
Otherwise, defaults to application/octet-stream.
A base64-encoded Data URL string.
base64.encodeDataURL(Asset("smile.gif"))
"data:image/gif;base64,R0lGODdhEAALAKIAAAAAALkAHACPAP///wAAAAAAAAAAAAAAACH5BAkAAAQALAAAAAAQAAsAAAMfSBqs2+6FyGYklcLLu/9gJAghMY4laoKkeL6qC59OAgA7"