Abstract
BinaryStream
Creates a new BinaryStream with an optional JavaScript Buffer.
Optional
buffer: null | BufferOptional
offset: null | numberbinary
The binary data of the stream.
offset
The current offset of the stream.
Static
Readonly
idThe packet id.
Static
Readonly
id_The packet id data type.
cursorAtEnd
Checks if the cursor is at the end of the stream.
cursorAtStart
Checks if the cursor is at the start of the stream.
Deserializes the packet.
Flushes the binary stream.
get
Gets a byte at a specific index in the stream.
getBuffer
Gets the binary as a JavaScript Buffer.
Gets the packet id.
The packet id.
Gets the packet id data type.
The packet id data type.
peek
Peeks at the next byte in the stream.
read
Reads a number of bytes from the stream.
readBool
Reads a boolean ( 1 byte ) value from the stream. ( true or false )
readBuffer
Reads a number of bytes from the stream and returns a JavaScript Buffer.
readByte
Reads a signed 8-bit ( 1 byte ) integer from the stream. ( -128 to 127 )
readFloat32
Reads a signed 32-bit ( 4 bytes ) integer from the stream. ( -2147483648 to 2147483647 )
Optional
endian: null | EndiannessreadFloat64
Reads a signed 64 bit ( 8 bytes ) floating point number from the stream. ( -1.7976931348623157e308 to 1.7976931348623157e308 )
Optional
endian: null | EndiannessreadInt16
Reads a signed 16-bit ( 2 bytes ) integer from the stream. ( -32768 to 32767 )
Optional
endian: null | EndiannessreadInt24
Reads a signed 24-bit ( 3 bytes ) integer from the stream. ( -8388608 to 8388607 )
Optional
endian: null | EndiannessreadInt32
Reads a signed 32-bit ( 4 bytes ) integer from the stream. ( -2147483648 to 2147483647 )
Optional
endian: null | EndiannessreadInt64
Reads a signed 64-bit ( 8 bytes ) integer from the stream. ( -9223372036854775808 to 9223372036854775807 )
Optional
endian: null | EndiannessreadInt8
Reads a signed 8-bit ( 1 byte ) integer from the stream. ( -128 to 127 )
readLong
Reads a signed 64-bit ( 8 bytes ) integer from the stream. ( -9223372036854775808 to 9223372036854775807 )
Optional
endian: null | EndiannessreadRemaining
Reads the remaining bytes from the stream.
readRemainingBuffer
Reads the remaining bytes from the stream and returns a JavaScript Buffer.
readShort
Reads a signed 16-bit ( 2 bytes ) integer from the stream. ( -32768 to 32767 )
Optional
endian: null | EndiannessreadString16
Reads an unsigned 16-bit ( 2 bytes ) utf-8 string from the stream. ( 0 to 65535 )
Optional
endian: null | EndiannessreadString32
Reads a signed 32-bit ( 4 bytes ) utf-8 string from the stream. ( 0 to 4294967295 )
Optional
endian: null | EndiannessreadUint16
Read an unsigned 16-bit ( 2 bytes ) integer from the stream. ( 0 to 65535 )
Optional
endian: null | EndiannessreadUint24
Reads an unsigned 24-bit ( 3 bytes ) integer from the stream. ( 0 to 16777215 )
Optional
endian: null | EndiannessreadUint32
Reads an unsigned 32-bit ( 4 bytes ) integer from the stream. ( 0 to 4294967295 )
Optional
endian: null | EndiannessreadUint64
Reads an usigned 64-bit ( 8 bytes ) integer from the stream. ( 0 to 18446744073709551615 )
Optional
endian: null | EndiannessreadUint8
Reads an unsigned 8-bit ( 1 byte ) integer from the stream. ( 0 to 255 )
readULong
Reads an usigned 64-bit ( 8 bytes ) integer from the stream. ( 0 to 18446744073709551615 )
Optional
endian: null | EndiannessreadUShort
Read an unsigned 16-bit ( 2 bytes ) integer from the stream. ( 0 to 65535 )
Optional
endian: null | EndiannessreadUuid
Reads a signed 128-bit ( 16 bytes ) uuid string from the stream.
readVarInt
Reads a 32 bit ( 4 bytes ) unsigned variable length integer from the stream. ( 0 to 4294967295 )
readVarLong
Reads a 64 bit ( 8 bytes ) unsigned variable length integer from the stream. ( 0 to 18446744073709551615 )
readVarString
Reads a signed 32-bit ( 4 bytes ) utf-8 string from the stream. ( 0 to 4294967295 )
readZigZag
Reads a 32 bit ( 4 bytes ) zigzag encoded signed variable length integer from the stream. ( -2147483648 to 2147483647 )
readZigZong
Reads a 64 bit ( 8 bytes ) zigzag encoded signed variable length integer from the stream. ( -9223372036854775808 to 9223372036854775807 )
Serializes the packet.
The serialized packet.
set
Sets a byte at a specific index in the stream.
skip
Skips a number of bytes from the stream.
write
Writes a number of bytes to the stream.
writeBool
Writes a boolean ( 1 byte ) value to the stream. ( true or false )
writeBuffer
Writes a JavaScript Buffer to the stream.
writeByte
Writes a signed 8-bit ( 1 byte ) integer to the stream. ( -128 to 127 )
writeFloat32
Write a signed 32-bit ( 4 bytes ) integer to the stream. ( -2147483648 to 2147483647 )
Optional
endian: null | EndiannesswriteFloat64
Writes a signed 64 bit ( 8 bytes ) floating point number to the stream. ( -1.7976931348623157e308 to 1.7976931348623157e308 )
Optional
endian: null | EndiannesswriteInt16
Writes a signed 16-bit ( 2 bytes ) integer to the stream. ( -32768 to 32767 )
Optional
endian: null | EndiannesswriteInt24
Writes a signed 24-bit ( 3 bytes ) integer to the stream. ( -8388608 to 8388607 )
Optional
endian: null | EndiannesswriteInt32
Write a signed 32-bit ( 4 bytes ) integer to the stream. ( -2147483648 to 2147483647 )
Optional
endian: null | EndiannesswriteInt64
Writes a signed 64-bit ( 8 bytes ) integer to the stream. ( -9223372036854775808 to 9223372036854775807 )
Optional
endian: null | EndiannesswriteInt8
Writes a signed 8-bit ( 1 byte ) integer to the stream. ( -128 to 127 )
writeLong
Writes a signed 64-bit ( 8 bytes ) integer to the stream. ( -9223372036854775808 to 9223372036854775807 )
Optional
endian: null | EndiannesswriteShort
Writes a signed 16-bit ( 2 bytes ) integer to the stream. ( -32768 to 32767 )
Optional
endian: null | EndiannesswriteString16
Writes an unsigned 16-bit ( 2 bytes ) utf-8 string to the stream. ( 0 to 65535 )
Optional
endian: null | EndiannesswriteString32
Writes a signed 32-bit ( 4 bytes ) utf-8 string to the stream. ( 0 to 4294967295 )
Optional
endian: null | EndiannesswriteUint16
Write an unsigned 16-bit ( 2 bytes ) integer to the stream. ( 0 to 65535 )
Optional
endian: null | EndiannesswriteUint24
Writes an unsigned 24-bit ( 3 bytes ) integer to the stream. ( 0 to 16777215 )
Optional
endian: null | EndiannesswriteUint32
Writes an unsigned 32-bit ( 4 bytes ) integer to the stream. ( 0 to 4294967295 )
Optional
endian: null | EndiannesswriteUint64
Writes an unsigned 64-bit ( 8 bytes ) integer to the stream. ( 0 to 18446744073709551615 )
Optional
endian: null | EndiannesswriteUint8
Writes an unsigned 8-bit ( 1 byte ) integer to the stream. ( 0 to 255 )
writeULong
Writes an unsigned 64-bit ( 8 bytes ) integer to the stream. ( 0 to 18446744073709551615 )
Optional
endian: null | EndiannesswriteUShort
Write an unsigned 16-bit ( 2 bytes ) integer to the stream. ( 0 to 65535 )
Optional
endian: null | EndiannesswriteUuid
Writes a signed 128-bit ( 16 bytes ) uuid string to the stream.
writeVarInt
Writes a 32 bit ( 4 bytes ) unsigned variable length integer to the stream. ( 0 to 4294967295 )
writeVarLong
Writes a 64 bit ( 8 bytes ) unsigned variable length integer to the stream. ( 0 to 18446744073709551615 )
writeVarString
Writes a signed 32-bit ( 4 bytes ) utf-8 string to the stream. ( 0 to 4294967295 )
writeZigZag
Writes a 32 bit ( 4 bytes ) zigzag encoded signed variable length integer to the stream. ( -2147483648 to 2147483647 )
writeZigZong
Writes a 64 bit ( 8 bytes ) zigzag encoded signed variable length integer to the stream. ( -9223372036854775808 to 9223372036854775807 )
Static
fromfrom
Creates a new BinaryStream from a binary vector.
Optional
offset: null | numberStatic
fromfromBuffer
Creates a new BinaryStream from a JavaScript Buffer.
Optional
offset: null | number
Represents a Minecraft Bedrock Edition data packet