Converts an ArrayBuffer into a base64 string.
The resulting string can optionally be a data uri if the mediaType
argument is provided.
See https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs for more details.
name | type | arguments | description |
---|---|---|---|
arrayBuffer | ArrayBuffer |
The Array Buffer to encode. |
|
mediaType | string | <optional> |
An optional media type, i.e. |
The base64 encoded Array Buffer.
Converts a base64 string, either with or without a data uri, into an Array Buffer.
name | type | description |
---|---|---|
base64 | string |
The base64 string to be decoded. Can optionally contain a data URI header, which will be stripped out prior to decoding. |
An ArrayBuffer decoded from the base64 data.