(dbPath: string, opts?: { readOnly?: boolean })
| 221 | * a process-global would race. |
| 222 | */ |
| 223 | export function createDatabase(dbPath: string, opts?: { readOnly?: boolean }): { db: SqliteDatabase; backend: SqliteBackend } { |
| 224 | try { |
| 225 | return { db: new NodeSqliteAdapter(dbPath, opts), backend: 'node-sqlite' }; |
| 226 | } catch (error) { |
| 227 | // A runtime without node:sqlite says so (NodeSqliteUnavailableError); |
| 228 | // anything SQLite itself reported names its code and the path. |
| 229 | throw toDatabaseOpenError(error, dbPath); |
| 230 | } |
| 231 | } |