API reference › @evolu/sqlite-wasm › writeUtf8

function writeUtf8(
  deps: SqliteWasmDep,
): (value: string, ptr: WasmPtr, capacity: number) => number;

Defined in: packages/sqlite-wasm/src/Memory.ts:88

Encodes a string as UTF-8 into existing memory and returns the byte length, without a NUL terminator.

The memory needs up to three bytes per UTF-16 code unit; text that does not fit is cut at a character boundary, so reserve value.length * 3 bytes. A lone surrogate becomes U+FFFD, as in allocCString.