Skip to content

Data

Raw data representation.

Raw data representation of strings, files and images.

+fromString

Creates data from string.

The provided string is assumed to be UTF8 encoded. If the string is not UTF8 encoded, the function will return null.

static fromString(string: string): Data

+fromFile

Reads data from file path.

Reads the raw data of the file at the specified file path.

static fromFile(filePath: string): Data

+fromBase64String

Creates data from base 64 encoded string.

The supplied string must be base 64 encoded otherwise the function will return null.

static fromBase64String(base64String: string): Data

+fromJPEG

Creates data from JPEG image.

static fromJPEG(image: Image): Data

+fromPNG

Creates data from PNG image.

static fromPNG(image: Image): Data

-toRawString

Creates a string from the data.

The data is assumed to represent a UTF8 encoded string. If the string is not UTF8 encoded string, the function will return null.

toRawString(): string

-toBase64String

Creates a base 64 encoded string.

Creates a base 64 encoded string from the data.

toBase64String(): string

-getBytes

Gets bytes from data.

getBytes(): [number]