api/utils

Some all-round re-usable utilities.

Source:

Methods

(static) asyncBlobToArrayBuffer(blob) → {Promise}

Source:

Async function to convert a Blob to an ArrayBuffer.

Parameters:
Name Type Description
blob Blob

The blob to read as ArrayBuffer

Returns:
Type
Promise

(static) checkAudioIsNotEmpty(filesize, mimeType) → {boolean}

Source:

A Cheap test to check if the provided audio file has just the header, or that it can be assumed to be "audio". The mimeType is used to do make a best guess. Currently only WAV is supported.

Parameters:
Name Type Description
filesize number

Size of the file to check.

mimeType string

Type of the provided blob.

Returns:
  • Has audio.
Type
boolean

(static) dataToBase64(data) → {string}

Source:

Convert the given ArrayBuffer to a base64 encoded string.

Parameters:
Name Type Description
data ArrayBuffer

The data to transform to base64.

Returns:
  • The base64 encoded data.
Type
string