bindings/javascript: Add async connect() function

Let's make the API symmetric with libSQL and serverless drivers.
This commit is contained in:
Pekka Enberg
2025-08-12 11:36:24 +03:00
parent 1c6a3bacb9
commit 96673a54a8
2 changed files with 18 additions and 7 deletions

View File

@@ -399,4 +399,15 @@ class Statement {
}
}
export { Database, SqliteError }
/**
* Creates a new database connection asynchronously.
*
* @param {string} path - Path to the database file.
* @param {Object} opts - Options for database behavior.
* @returns {Promise<Database>} - A promise that resolves to a Database instance.
*/
async function connect(path: string, opts: any = {}): Promise<Database> {
return new Database(path, opts);
}
export { Database, SqliteError, connect }