Base64Utils Class

Module: BinaryUtils

Base64Utils contains methods to convert from and to Base64 binary format.

Methods

fromArraybuffer

(
  • arraybuffer
)
String

Create base64 string from arraybuffer.

Parameters:

  • arraybuffer ArrayBuffer

Returns:

String:

base64

fromBinaryString

(
  • str
)
String

Create base64 string from binary string.

Parameters:

  • str String

Returns:

String:

base64

getFileFormat

(
  • data
)
String

Get the file format present in the base64 string.

Parameters:

  • data String

    Base64 data.

Returns:

String:

File format present in the JSON data.

isBase64

(
  • data
)
Boolean

Check if some data is encoded as base64.

This is a fast test that picks some random position in the string to check if they are valid base64 characters.

Parameters:

  • data Object

    Data to be tested.

Returns:

Boolean:

True if data is base64 encoded, false otherwise.

removeHeader

(
  • base64
)
String

Remove base64 header from data.

Usefull for removing the heander from image, audio, video, etc.

Parameters:

  • base64 String

Returns:

String:

base64

Attributes

encoding

String

Charset used to encode binary data.