<abstract> new BinaryConverter()
Methods
-
base64ToString(value)
-
Decode a base64 string into its equivalent UTF8 string.
Parameters:
Name Type Description value
string Returns:
- Type
- string
-
binaryToDataUrl(content, mimeType)
-
Return a data url based on the provided array buffer and mimeType. It uses the specified encoding to create the base64 transformation.
Parameters:
Name Type Description content
ArrayBuffer mimeType
string Returns:
the data url
- Type
- string
-
binaryToString(binary)
-
Convert the binary buffer content to the corresponding string using UTF-8 encoding.
Parameters:
Name Type Description binary
ArrayBuffer Returns:
- Type
- string
-
<abstract> createObjectUrl(blob)
-
Generates a unique Object URL to access the Blob later on. Format is "blob:...".
Parameters:
Name Type Description blob
Blob Returns:
- Type
- string
-
dataUrlToBinary(url)
-
Retrieves the binary content of a base64 data URL.
Parameters:
Name Type Description url
string Throws:
-
when the specified url is not a base64 data url.
- Type
- Error
Returns:
- Type
- ArrayBuffer
-
-
<abstract> fetchFromObjectUrl(url, onSuccess [, onFailure])
-
Fetch the blob from the specified object url. Call onSuccess if it succeeds, onFailure ontherwise.
Parameters:
Name Type Argument Description url
string onSuccess
function onFailure
function <optional>
-
<abstract> fromBase64(value)
-
Parameters:
Name Type Description value
string Returns:
- Type
- ArrayBuffer
-
<abstract> readBlob(blob, done)
-
Read a blob and return the ArrayBuffer containing the blob content.
Parameters:
Name Type Description blob
Blob done
function -
<abstract> revokeObjectUrl(url)
-
An object URL must be revoked when won't be used anymore. It releases memory used to store the binary pointed by the URL and make the URL not usable anymore.
Parameters:
Name Type Description url
string -
stringToBase64(value)
-
Encode the specified UTF8 string into the equivalent base64 string.
Parameters:
Name Type Description value
string Returns:
- Type
- string
-
stringToBinary(string)
-
Convert the provided string to an ArrayBuffer, using the UTF-8 encoding.
Parameters:
Name Type Description string
string the string to convert
Returns:
- Type
- ArrayBuffer
-
<abstract> toBase64(value)
-
Parameters:
Name Type Description value
ArrayBuffer Returns:
- Type
- string