Buffer object

The Buffer object holds and manages raw binary data

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