API reference › @evolu/sqlite-wasm › createSqliteDatabase
function createSqliteDatabase(
deps: SqliteWasmDep,
): (options: SqliteDatabaseOptions) => Result<SqliteDatabase, SqliteError>;
Defined in: packages/sqlite-wasm/src/Database.ts:768
Opens a database.
With a wrong key or a file that is not a database, it fails with
SQLITE_NOTADB, or with SQLITE_CORRUPT for a wrong key and a hot journal whose
first record is not page 1. An encrypted database opened without its key
while it has a hot journal that records pages fails with SQLITE_CANTOPEN,
caused by the codec's SqliteEncryptionUnsupportedError, and the
journal stays for the key. A leftover journal that is not hot, such as one
journal_mode = PERSIST or TRUNCATE keeps, gives SQLITE_NOTADB, as no
journal does. For encrypted databases that 2.2.4 may have keyed, use
createEncryptedSqliteDatabase.