utf8-buffer

Methods

(static) pack(str, buffer, indexopt) → {number}

Source:
See:
Write a string of UTF-8 characters to a byte buffer.
Parameters:
Name Type Attributes Description
str string The string to pack.
buffer Uint8Array | !Array.<number> The buffer to pack the string to.
index number <optional>
The buffer index to start writing.
Returns:
The next index to write in the buffer.
Type
number

(static) unpack(buffer, startopt, endopt, nullable) → {string}

Source:
See:
Read a string of UTF-8 characters from a byte buffer. Invalid characters are replaced with 'REPLACEMENT CHARACTER' (U+FFFD).
Parameters:
Name Type Attributes Description
buffer Uint8Array | !Array.<number> A byte buffer.
start number <optional>
The buffer index to start reading.
end number <optional>
<nullable>
The buffer index to stop reading. Assumes the buffer length if undefined.
Returns:
Type
string