Registry / database / sqlite-fieldservice

sqlite-fieldservice

JSON →
library1.0.8jsnpmunverified

A Capacitor community plugin providing native SQLite database support for Android, iOS, Electron, and web platforms. Version 1.0.8 targets Capacitor 3 and is actively maintained. It offers a unified API for creating connections, executing queries, and managing encrypted databases (Android/iOS only). Requires manual WASM file copy for web, and additional npm packages for Electron. Differentiators: full cross-platform support including Electron and browser, encrypted DB support on mobile, and imperative connection management.

npm install sqlite-fieldservice
INSTALL
IMPORT
SIG · SQLITE-FIELDSERVIC
S
sqlite-fieldservice
databasejavascriptv1.0.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SQLiteConnection
import { SQLiteConnection } from '@capacitor-community/sqlite'
const SQLiteConnection = require('@capacitor-community/sqlite').SQLiteConnection
ESM import for TypeScript; CommonJS require also works but not type-safe.
capacitorSQLite
import { capacitorSQLite } from '@capacitor-community/sqlite'
import SQLite from '@capacitor-community/sqlite'
capacitorSQLite is the default instance; avoid default import.
sqliteConnection
import { sqliteConnection } from '@capacitor-community/sqlite'
import { SQLiteConnection } from '@capacitor-community/sqlite'
sqliteConnection is a pre-created connection; SQLiteConnection is the class.

Initializes SQLite connection across platforms, creates a table, and demonstrates mandatory initWebStore for web.

import { Capacitor } from '@capacitor/core'; import { SQLiteConnection, capacitorSQLite } from '@capacitor-community/sqlite'; async function initDatabase() { const platform = Capacitor.getPlatform(); const sqlite = new SQLiteConnection(capacitorSQLite); if (platform === 'web') { await customElements.whenDefined('jeep-sqlite'); const jeepSqliteEl = document.querySelector('jeep-sqlite'); if (jeepSqliteEl) { await sqlite.initWebStore(); } } const db = await sqlite.createConnection('testDB', false, 'no-encryption', 1, false); await db.open(); const res = await db.execute('CREATE TABLE IF NOT EXISTS test (id INTEGER PRIMARY KEY, name TEXT)'); console.log('Table created', res.changes); await db.close(); await sqlite.closeConnection('testDB'); }
Debug
Known issues
breakingSince v3.2.3-1, initWebStore is mandatory for web platform
fix
Call await sqlite.initWebStore() after the jeep-sqlite element is defined for web apps.
affects: >=3.2.3-1
deprecatedUsing older version without initWebStore will fail silently on web
fix
Upgrade to >=3.2.3-1 and add initWebStore call.
affects: <3.2.3-1
gotchaEncrypted databases only work on Android and iOS, not Electron or Web
fix
Use non-encrypted database for Electron/Web or handle with conditional code.
affects: *
gotchacopyFromAssets method now supports zip files, but optional overwrite parameter default changed to true
fix
If you rely on overwrite=false, pass it explicitly: copyFromAssets({overwrite: false}).
affects: >=3.2.5-2
gotchaWeb requires manual copy of sql-wasm.wasm from node_modules/sql.js/dist to assets
fix
Copy sql-wasm.wasm to src/assets (Angular) or public/assets (Vue/React).
affects: *
Errors
Common errors & fixes
Error: Connection testDB does not exist
Trying to close or open a connection before creating it with createConnection
fix
Ensure await sqlite.createConnection(...) is called before using the connection.
TypeError: Cannot read properties of undefined (reading 'initWebStore')
initWebStore called before jeep-sqlite custom element is defined
fix
Add await customElements.whenDefined('jeep-sqlite') before initWebStore.
Error: sqlite3 is not installed (Electron)
Missing native sqlite3 package in Electron folder
fix
Navigate to electron/ and run: npm install --save sqlite3 jszip
Upgrade
Version history
1.0.8latest on npm
Audit
Dependencies
@capacitor/corerequiredRequired peer dependency for Capacitor plugin compatibility
Agent activity
27 hits · last 30 days
node
22
Meta
2
Amazon
1
OpenAI (training)
1
Resources
sqlite-fieldservice — npm install sqlite-fieldservice · libregistry