The current position of the writer or reader.
const writer = HazelWriter.alloc(2);writer.uint16(4);console.log(writer.cursor); // => 2 Copy
const writer = HazelWriter.alloc(2);writer.uint16(4);console.log(writer.cursor); // => 2
The number of bytes left in the writer or reader.
const writer = HazelWriter.alloc(6);writer.uint16(4);console.log(writer.left); // => 4 Copy
const writer = HazelWriter.alloc(6);writer.uint16(4);console.log(writer.left); // => 4
The buffer that the writer or reader is targeting.
const writer = HazelWriter.alloc(6);console.log(writer; // => <HazelBuffer [00] 00 00 00 00 00> Copy
const writer = HazelWriter.alloc(6);console.log(writer; // => <HazelBuffer [00] 00 00 00 00 00>
The size of the buffer that the writer or reader is targeting.
const writer = HazelWriter.alloc(6);console.log(writer.size); // => 6 Copy
const writer = HazelWriter.alloc(6);console.log(writer.size); // => 6
Check whether two hazel buffers contain the same information.
The other hazel writer to check.
Whether or not the hazel writers are the same.
const writer = HazelWriter.alloc(2);writer.uint8(21);writer.uint8(69);const writer2 = HazelWriter.alloc(2);writer.uint8(21);writer.uint8(69);console.log(writer.compare(writer2)); // => truewriter2.uint8(90);console.log(writer.compare(writer2)); // => false Copy
const writer = HazelWriter.alloc(2);writer.uint8(21);writer.uint8(69);const writer2 = HazelWriter.alloc(2);writer.uint8(21);writer.uint8(69);console.log(writer.compare(writer2)); // => truewriter2.uint8(90);console.log(writer.compare(writer2)); // => false
Move the cursor to a position.
The position to move to.
The writer.
const writer = HazelWriter.alloc(12);writer.goto(5);console.log(writer.cursor); // => 5 Copy
const writer = HazelWriter.alloc(12);writer.goto(5);console.log(writer.cursor); // => 5
Skip a speciied number of bytes.
const writer = HazelWriter.alloc(12);writer.skip(3);writer.skip(2);writer.skip(5);console.log(writer.cursor); // => 10 Copy
const writer = HazelWriter.alloc(12);writer.skip(3);writer.skip(2);writer.skip(5);console.log(writer.cursor); // => 10
The current position of the writer or reader.