Skip to content

init

init(directory?, commitWorkerBin?): void

Defined in: .work/repos/olmdb/src/lowlevel.ts:40

Initializes the database system with the specified directory.

Must be called once per JavaScript thread (i.e. once on the main thread and once inside each Node.js / Bun Worker that intends to use OLMDB). Each Worker gets its own independent native client, so concurrent transactions across Workers are safe; all clients in the same process that point at the same database directory share a single commit-worker daemon.

Can be called multiple times within the same thread if directory and commitWorkerBin are identical.

string

Optional path to the database directory. If not provided, defaults to the OLMDB_DIR environment variable or ”./.olmdb”.

string = ...

Path to the commit worker binary. Defaults to <base_dir>/build/release/commit_worker.

void

DatabaseError if initialization fails