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

Method constructor

packages/core/src/binary/writer.ts:33–50  ·  view source on GitHub ↗
(capacity: number)

Source from the content-addressed store, hash-verified

31 private off = 0;
32
33 constructor(capacity: number) {
34 if (!Number.isInteger(capacity) || capacity < 0) {
35 throw new ZrBinaryError({
36 code: "ZR_LIMIT",
37 offset: 0,
38 detail: `capacity must be a non-negative integer (got ${String(capacity)})`,
39 });
40 }
41 if (capacity > MAX_WRITER_CAPACITY_BYTES) {
42 throw new ZrBinaryError({
43 code: "ZR_LIMIT",
44 offset: 0,
45 detail: `capacity ${String(capacity)} exceeds maximum ${String(MAX_WRITER_CAPACITY_BYTES)}`,
46 });
47 }
48 this.buf = new Uint8Array(capacity);
49 this.dv = new DataView(this.buf.buffer, this.buf.byteOffset, this.buf.byteLength);
50 }
51
52 get offset(): number {
53 return this.off;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected