@collection-storage/sqlite
v4.0.5
Published
SQLite adaptor for collection-storage
Maintainers
Readme
Collection Storage SQLite Connector
This is a database connector for collection-storage. See the main project's documentation for general usage.
Install dependency
npm install --save collection-storage @collection-storage/sqliteFor synchronous access:
import '@collection-storage/sqlite';Or, for dynamic access (only loaded if / when used):
import { CollectionStorage } from 'collection-storage';
CollectionStorage.dynamic([
['sqlite', () => import('@collection-storage/sqlite')],
]);Note that this requires Node.js 22.13+.
Connection String
sqlite://[path][?options]The options can include:
timeout=nthe busy timeout (in milliseconds)
Notes:
- if no path is given, an in-memory SQLite database is used (
memory://is a better choice for in-memory storage unless you have a specific reason to use SQLite) - only absolute paths are permitted, i.e. valid URLs have 3
/s at the start:sqlite:///foo/bar - due to the nature of SQLite, you must not have multiple processes connected to the same database file simultaneously
- internally this uses Node's built-in
DatabaseSync, which
performs queries synchronously on the main thread. This means that
long-running queries can block the entire application. Ensure you set a
timeoutto avoid potential denial-of-service.
