Creates a new ByteStringBuffer.
Optionalb: stringOptional initial bytes as a binary encoded string (one byte per character, char codes 0-255).
Gets a byte at the given index without modifying the read pointer.
the byte index.
the byte.
Gets a binary encoded string of the bytes from this buffer without modifying the read pointer.
Optionalcount: numberthe number of bytes to get, omit to get all.
a string full of binary encoded characters.
Clears this buffer.
this buffer.
Compacts this buffer.
this buffer.
Gets a byte from this buffer and advances the read pointer by 1.
the byte.
Reads bytes out as a binary encoded string and clears them from the
buffer. Note that the resulting string is binary encoded (in node.js this
encoding is referred to as binary, it is not utf8).
Optionalcount: numberthe number of bytes to read, undefined or null for all.
a binary encoded string of bytes.
Gets an n-bit integer from this buffer in big-endian order and advances the read pointer by ceil(n/8).
the number of bits in the integer (8, 16, 24, or 32).
the integer.
Gets a uint32 from this buffer in big-endian order and advances the read pointer by 4.
the word.
Gets the number of bytes in this buffer.
the number of bytes in this buffer.
Puts a byte in this buffer.
the byte to put.
this buffer.
Puts bytes in this buffer.
the bytes (as a binary encoded string) to put.
this buffer.
Puts a 32-bit integer in this buffer in big-endian order.
the 32-bit integer.
this buffer.
Converts this buffer to an ArrayBuffer.
An ArrayBuffer.
Converts this buffer to a hexadecimal string.
a hexadecimal string.
A binary string backed byte buffer for efficient binary data manipulation.
This class provides methods for reading and writing binary data using JavaScript strings as the underlying storage. Each character in the string represents one byte (0-255).
Example