Data¶
Raw data representation.
Raw data representation of strings, files and images.
+fromString¶
Creates data from string.
static fromString(string: string): Data
The provided string is assumed to be UTF8 encoded. If the string is not UTF8 encoded, the function will return null.
Parameters¶
string
string
String to create data from.
Return value¶
Data
Data representation of the string.
+fromFile¶
Reads data from file path.
static fromFile(filePath: string): Data
Reads the raw data of the file at the specified file path.
Parameters¶
filePath
string
Path of file to read data from.
Return value¶
Data
Data representation of the file.
+fromBase64String¶
Creates data from base64 encoded string.
static fromBase64String(base64String: string): Data
The supplied string must be base64 encoded otherwise the function will return null.
Parameters¶
base64String
string
Base64 encoded string to create data from.
Return value¶
Data
Data representation of the string.
+fromJPEG¶
Creates data from JPEG image.
static fromJPEG(image: Image): Data
Parameters¶
image
Image
JPEG image to convert to data.
Return value¶
Data
Data representation of the image.
+fromPNG¶
Creates data from PNG image.
static fromPNG(image: Image): Data
Parameters¶
image
Image
PNG image to convert to data.
Return value¶
Data
Data representation of the image.
+fromBytes¶
Creates data from an array of bytes.
static fromBytes(bytes: [number]): Data
Parameters¶
bytes
[number]
Array of bytes to convert to data.
Return value¶
Data
Data creates from the bytes.
-toRawString¶
Creates a string from the data.
toRawString(): string
The data is assumed to represent a UTF8 encoded string. If the string is not UTF8 encoded string, the function will return null.
Return value¶
string
Data converted to string.
-toBase64String¶
Creates a base64 encoded string.
toBase64String(): string
Creates a base64 encoded string from the data.
Return value¶
string
Base64 encoded string.
-getBytes¶
Gets bytes from data.
getBytes(): [number]
Return value¶
[number]
Array of bytes.