init
init(
dbDir?):void
Defined in: .work/repos/olmdb/src/olmdb.ts:237
Initialize the database with the specified directory path. This function may be called multiple times with the same parameters. If it is not called before the first transact(), the database will be automatically initialized with the default directory.
Parameters
Section titled “Parameters”dbDir?
Section titled “dbDir?”string
Optional directory path for the database (defaults to environment variable $OLMDB_DIR or ”./.olmdb”).
Returns
Section titled “Returns”void
Throws
Section titled “Throws”With code “INCONSISTENT_INIT” if database is already initialized with different parameters.
Throws
Section titled “Throws”With code “CREATE_DIR_FAILED” if directory creation fails.
Throws
Section titled “Throws”With code “LMDB-{code}” for LMDB-specific errors.
Example
Section titled “Example”init("./my-database");