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

Method ensureAvailable

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

* Validate that n bytes are available from current cursor position. * Throws ZR_TRUNCATED if buffer would be exceeded.

(n: number)

Source from the content-addressed store, hash-verified

110 * Throws ZR_TRUNCATED if buffer would be exceeded.
111 */
112 private ensureAvailable(n: number): void {
113 if (this.off + n > this.byteLength) {
114 throw new ZrBinaryError({
115 code: "ZR_TRUNCATED",
116 offset: this.off,
117 detail: `need ${n} byte(s) but only ${Math.max(0, this.byteLength - this.off)} remaining`,
118 });
119 }
120 }
121}

Callers 5

skipMethod · 0.95
readU8Method · 0.95
readU32Method · 0.95
readI32Method · 0.95
readBytesMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected