Phaser API Documentation

  Version: 

Member of: Phaser.Utils.Base64

<static> ArrayBufferToBase64(arrayBuffer, [mediaType])

Description:

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.

Parameters:

name type arguments description
arrayBuffer ArrayBuffer

The Array Buffer to encode.

mediaType string <optional>

An optional media type, i.e. audio/ogg or image/jpeg. If included the resulting string will be a data URI.

Returns:
Description:

The base64 encoded Array Buffer.

Type:
  • string
Examples:
Since: 3.18.0