MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / readBytes

Method readBytes

packages/core/src/binary/reader.ts:96–106  ·  view source on GitHub ↗

* Read len bytes as a subarray view, advancing cursor by len bytes. * The returned Uint8Array shares the underlying buffer with the reader.

(len: number)

Source from the content-addressed store, hash-verified

94 * The returned Uint8Array shares the underlying buffer with the reader.
95 */
96 readBytes(len: number): Uint8Array {
97 if (!Number.isInteger(len) || len < 0) {
98 throw new Error(
99 `BinaryReader.readBytes: len must be a non-negative integer (got ${String(len)})`,
100 );
101 }
102 this.ensureAvailable(len);
103 const out = this.bytes.subarray(this.off, this.off + len);
104 this.off += len;
105 return out;
106 }
107
108 /**
109 * Validate that n bytes are available from current cursor position.

Callers 4

parseEventBatchV1Function · 0.95
parseErrorRecordFunction · 0.95
assertReaderRoundTripFunction · 0.95
assertTruncatedReadsFailFunction · 0.95

Calls 1

ensureAvailableMethod · 0.95

Tested by 2

assertReaderRoundTripFunction · 0.76
assertTruncatedReadsFailFunction · 0.76