Buffer object

Property Description Access Type
Buffer.size Get the buffer length in bytes readwrite number
Buffer.encoding Get/set the buffer encoding for string conversion readwrite string
Operation Description
Buffer indexation Index the buffer by byte position
Buffer concatenation Concatenate the buffer with another one or with a string
Buffer iteration Iterate over the buffer, byte by byte
String conversion Convert the buffer to a string
Equality comparison Compare the buffer for equality
#Buffer length operator Get the size of the Buffer in bytes
Method Description Return value
Buffer.constructor() Buffer object constructor Buffer
Buffer:append() Append data to the buffer -
Buffer:contains() Search for bytes pattern in the buffer number or boolean
Buffer:sub() Extracts part of the bytes from the buffer Buffer
Buffer:from() Reinitialize the buffer with new data -
Buffer:pack() Reinitialize the buffer with serialized data -
Buffer:unpack() Deserialize values from the buffer any values
Buffer:encode() Encode the buffer string