DataURL

convertObjToJsonDataUrl(obj, mimeopt) → {string}

Convert the given object to an "application/json" Data URL string.
Parameters:
Name Type Attributes Default Description
obj * Object to convert. If not a string then gets converted via "JSON.stringify" before.
mime string <optional>
'application/json' Mime type. It's usually "application/json" (default value) or "model/gltf+json" (for usage with gltf data).
Returns:
Resulting Data URL string.
Type
string

convertObjToTextDataUrl(obj) → {string}

Convert the given object to a "text/plain" Data URL string.
Parameters:
Name Type Description
obj * Object to convert. If not a string then gets converted via "JSON.stringify" before.
Returns:
Resulting Data URL string.
Type
string

(constant) dataUrlRe :RegExp

A regular expression to parse a Data URL string.
Type:
  • RegExp
Default Value:
  • /^data:(.+\/.+);base64,(.*)$/

decodeUnicodeStrFromBase64(str) → {string}

Decode the given base64 string into a Unicode string.
Parameters:
Name Type Description
str string Base64 string to decode.
See:
Returns:
Base64 string converted to a Unicode string.
Type
string

encodeUnicodeStrToBase64(str) → {string}

Encode the given Unicode string into a base64 string.
Parameters:
Name Type Description
str string Unicode string to encode.
See:
Returns:
Unicode string converted to a base64 string.
Type
string

extractDataUrlData(str) → {string}

Extract data from the given Data URL string.
Parameters:
Name Type Description
str string Data URL string to extract from.
Returns:
Extracted data as a Unicode string.
Type
string

isBlobUrl(obj) → {boolean}

Check whether the given object is a Blob URL string or not.
Parameters:
Name Type Description
obj * Object to check.
Returns:
Check result.
Type
boolean

isDataUrl(obj) → {boolean}

Check whether the given object is a Data URL string or not.
Parameters:
Name Type Description
obj * Object to check.
Returns:
Check result.
Type
boolean