MCPcopy
hub / github.com/electric-sql/pglite / addCString

Method addCString

packages/pg-protocol/test/testing/buffer-list.ts:33–39  ·  view source on GitHub ↗
(val: string, front?: boolean)

Source from the content-addressed store, hash-verified

31 }
32
33 public addCString(val: string, front?: boolean) {
34 const len = byteLengthUtf8(val)
35 const bufferView = new Uint8Array(len + 1)
36 new TextEncoder().encodeInto(val, bufferView)
37 bufferView[len] = 0
38 return this.add(bufferView.buffer, front)
39 }
40
41 public addString(val: string, front?: boolean) {
42 const len = byteLengthUtf8(val)

Callers 2

test-buffers.tsFile · 0.45

Calls 2

addMethod · 0.95
byteLengthUtf8Function · 0.90

Tested by

no test coverage detected