API reference › @evolu/sqlite-wasm › allocCString

function allocCString(
  deps: SqliteWasmDep,
): (value: string) => Result<SqliteOwnedCStringPtr, SqliteNoMemError>;

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

Copies a string into new memory as a NUL-terminated UTF-8 C string, which the caller frees with sqlite3_free.

UTF-8 cannot encode a lone surrogate, which becomes U+FFFD, as with TextEncoder, so a caller that needs the exact text checks String.prototype.isWellFormed first.