hometiscriptBytes

Bytes object

Bytes is an array of bytes.

Constants

N/A

Properties

[index] - integer, element of the array at the index position, read-write index accessor. Zero-based integer index.
length - integer, read-only, number of bytes in the byte vector.
type - any, could be used for any purposes but sciter uses it to report mime-type (string) of the data received or sent by request() method.
name - any, could be used for any purposes but sciter uses it to report file name (string) of the data received or sent by request() method.

Methods

this

( numBytes: integer )

Constructs object of type Bytes - sequence of bytes of numBytes length.

toString

( [encoding:string] ) returns: string

If encoding is not provided then the method returns base64 representation of the byte vector. Otherwise if encoding is one of supported encondings from IANA charset list http://www.iana.org/assignments/character-sets the function returns decoded string.

E.g. var str = bytes.toString("UTF-8"); returns a string from UTF-8 encoded bytes.

save
( filename:string ) returns: true|false

Saves content of the byte vector into the file. If file exists then it will be overwritten.

load
( filename:string ) returns: Bytes

Static method. Creates new Bytes object, loads file into it and returns that object.

TIScript

Classes
Download