SQLite driver for Cordova/ionic apps using localForage (stable v1.8.0, released 2020). This driver allows localForage to use the native SQLite databases on mobile devices via the Cordova SQLite storage plugin (or sqlcipher). It inherits the WEBSQL driver implementation to reduce size and adds support for dropInstance(), dbKey for encryption, and TypeScript typings. Key differentiators: it bridges localForage's async key-value API to native SQLite, enabling persistent storage in hybrid mobile apps where IndexedDB may not be available. Requires localForage >= 1.5.0 and a Cordova SQLite plugin. Maintained, low release cadence (~yearly).
npm install localforage-cordovasqlitedriverNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to define and set the cordovaSQLiteDriver for localforage, including fallback drivers and encryption support.
Set the location property in localforage.config() to the previous location value (0 for iOS <= 1.1). See the plugin's iCloud guide.
Call localforage.defineDriver(cordovaSQLiteDriver) before localforage.setDriver().
Use cordovaSQLiteDriver._driver as the first argument in setDriver() array.
Test on an emulator/device or mock the plugin in a browser environment.
Ensure tsconfig.json has 'moduleResolution': 'node' or use the bundled types directly.
Add localforage.defineDriver(cordovaSQLiteDriver) before setDriver().
Use import * as cordovaSQLiteDriver from 'localforage-cordovasqlitedriver';
Ensure the script is included after cordova.js and loaded in the correct order, or use module import.
Add .catch(err => console.error(err)) to the promise chain.