Registry / database / fieldservice-sqlite-fat

fieldservice-sqlite-fat

JSON →
library1.0.11jsnpmunverified

A Capacitor community plugin for native and Electron SQLite databases. Current stable version is 3.2.5-2, actively maintained with frequent releases. Supports Android, iOS, Electron, and Web platforms. Key differentiators: encrypted database support for mobile and desktop (not web), ZIP file import with overwrite, and mandatory initWebStore for web platform fix since v3.2.3-1. Requires manual wasm file copy for web. Electron requires additional sqlite3 and jszip dependencies. Tested with Ionic/Angular, React, Vue starters.

npm install fieldservice-sqlite-fat
INSTALL
IMPORT
SIG · FIELDSERVICE-SQLIT
F
fieldservice-sqlite-fat
databasejavascriptv1.0.11
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')
ESM package, use import syntax. CommonJS require will fail.
capacitorSQLite
import { capacitorSQLite } from '@capacitor-community/sqlite'
Default export for Capacitor plugin registration.
sqliteConnection
import { sqliteConnection } from '@capacitor-community/sqlite'
import { sqliteConnection } from '@capacitor-community/sqlite/native'
Non-existent path; only top-level import is correct.

Initializes SQLite connection, creates database, executes SQL, and cleans up. Shows web platform initWebStore.

import { Capacitor } from '@capacitor/core'; import { SQLiteConnection, capacitorSQLite } from '@capacitor-community/sqlite'; async function initializeSQLite() { const sqliteConnection = new SQLiteConnection(capacitorSQLite); if (Capacitor.getPlatform() === 'web') { await customElements.whenDefined('jeep-sqlite'); const jeepSqliteEl = document.querySelector('jeep-sqlite'); if (jeepSqliteEl) { await sqliteConnection.initWebStore(); } } const db = await sqliteConnection.createConnection('myDb', false, 'no-encryption', 1); await db.open(); await db.execute('CREATE TABLE IF NOT EXISTS test (id INTEGER PRIMARY KEY, name TEXT)'); await db.run('INSERT INTO test VALUES (?, ?)', [1, 'Capacitor']); const rows = await db.query('SELECT * FROM test'); console.log(rows); await db.close(); await sqliteConnection.closeConnection('myDb'); } initializeSQLite();
Debug
Known issues
breakingSince v3.2.3-1, initWebStore is mandatory for Web platform before any database operations.
fix
Call await sqliteConnection.initWebStore() after jeep-sqlite element is defined.
affects: >=3.2.3-1
gotchaEncrypted databases are not supported on Electron and Web platforms.
fix
Use 'no-encryption' or plaintext mode for Electron/Web.
affects: *
gotchaElectron requires manual installation of sqlite3, jszip, and @types/sqlite3 in the electron folder.
fix
Run npm install --save sqlite3 jszip --save-dev @types/sqlite3 inside electron/ folder.
affects: *
gotchaWeb platform requires manual copy of sql-wasm.wasm from sql.js to assets folder.
fix
Copy nodes_modules/sql.js/dist/sql-wasm.wasm to src/assets (Angular) or public/assets (Vue/React).
affects: *
deprecatedThe method 'initWebStore' was added in v3.2.3-1 and is mandatory; previous versions without it may break on web.
fix
Update to latest version and add initWebStore call.
affects: <3.2.3-1
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'jeep-sqlite')
Missing jeep-sqlite custom element on Web platform.
fix
Ensure <jeep-sqlite> exists in index.html or dynamically create it.
Error: initWebStore must be called before any database operation on Web.
Forgetting to call initWebStore on Web after v3.2.3-1.
fix
Add initWebStore call as shown in the quickstart.
Module not found: Can't resolve 'sql.js'
Missing sql.js dependency or wrong path to sql-wasm.wasm.
fix
Install sql.js and copy sql-wasm.wasm to assets folder.
Error: database is encrypted
Trying to open an encrypted database on Electron/Web.
fix
Use non-encrypted mode on those platforms.
Upgrade
Version history
1.0.11latest on npm
Audit
Dependencies
@capacitor/corerequiredpeer dependency for Capacitor v3
Agent activity
9 hits · last 30 days
node
8
Resources
fieldservice-sqlite-fat — npm install fieldservice-sqlite-fat · libregistry