Registry / database / pouchdb-adapter-node-websql

pouchdb-adapter-node-websql

JSON →
library7.0.0jsnpmunverified

PouchDB adapter that uses Node.js-based SQLite (via node-websql) as its data store. Latest stable version is 7.0.0. This package is part of the PouchDB monorepo and targets Node.js environments only, providing a WebSQL-compatible backend. It is designed for use with PouchDB's plugin system and requires explicit registration. Not recommended for new projects; consider using pouchdb-adapter-leveldb or pouchdb-adapter-node-websql as part of PouchDB’s custom builds for better performance and modern SQLite bindings. The adapter name is 'websql'. Maintained by the PouchDB team.

npm install pouchdb-adapter-node-websql
INSTALL
IMPORT
SIG · POUCHDB-ADAPTER-NO
P
pouchdb-adapter-node-websql
databasejavascriptv7.0.0
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.

default
✓ import PouchDB from 'pouchdb-core'; import pouchAdapterNodeWebsql from 'pouchdb-adapter-node-websql'; PouchDB.plugin(pouchAdapterNodeWebsql);
✗ const PouchDB = require('pouchdb-adapter-node-websql');
Adapter is not a standalone PouchDB; it must be used with pouchdb-core and registered via plugin.
default
✓ var PouchDB = require('pouchdb-core'); require('pouchdb-adapter-node-websql')(PouchDB); var db = new PouchDB('mydb', {adapter: 'websql'});
✗ var db = new PouchDB('mydb', {adapter: 'node-websql'});
CommonJS usage: must call the module as a function to register the adapter.
plugin registration
✓ PouchDB.plugin(require('pouchdb-adapter-node-websql'));
✗ var db = new PouchDB('mydb', {adapter: 'websql'}); without prior plugin registration
The adapter must be registered via plugin before use; otherwise adapter name 'websql' is unrecognized.

Demonstrates PouchDB plugin registration and creating a database using the WebSQL adapter in Node.js.

const PouchDB = require('pouchdb-core'); require('pouchdb-adapter-node-websql')(PouchDB); const db = new PouchDB('my_database', { adapter: 'websql' }); db.put({ _id: 'test', name: 'Hello' }).then(() => { return db.get('test'); }).then(doc => { console.log(doc.name); }).catch(err => console.error(err));
Debug
Known issues
deprecatedpouchdb-adapter-node-websql is deprecated. Use pouchdb-adapter-leveldb or custom builds with SQLite support.
fix
Switch to pouchdb-adapter-leveldb or use PouchDB's default adapter for Node.
affects: >=7.0.0
gotchaThe adapter name is 'websql', not 'node-websql' or 'sqlite'.
fix
Use {adapter: 'websql'} when creating a PouchDB instance.
affects: >=1.0.0
gotchaAdapter must be registered via PouchDB.plugin() before use; otherwise PouchDB will throw an error for unknown adapter.
fix
Call PouchDB.plugin(require('pouchdb-adapter-node-websql')) before creating any database instances.
affects: >=6.0.0
gotchaThis adapter only works in Node.js, not in browsers.
fix
Use pouchdb-adapter-websql for browser environments.
affects: >=1.0.0
breakingPouchDB 7.0.0 dropped default adapter auto-detection for node-websql; you must explicitly install and register this adapter.
fix
Install pouchdb-adapter-node-websql and register via plugin as shown.
affects: >=7.0.0
Errors
Common errors & fixes
Error: unknown adapter "websql"
Adapter not registered via plugin before creating database.
fix
const PouchDB = require('pouchdb-core'); require('pouchdb-adapter-node-websql')(PouchDB);
TypeError: PouchDB.plugin is not a function
Using pouchdb-adapter-node-websql directly instead of pouchdb-core.
fix
Install 'pouchdb-core' and import/require it, then use PouchDB.plugin(adapter).
Module not found: Can't resolve 'pouchdb-adapter-node-websql'
Package not installed or missing from node_modules.
fix
npm install pouchdb-adapter-node-websql
Upgrade
Version history
7.0.0latest on npm
Audit
Dependencies
pouchdb-corerequiredPouchDB core library required for adapter functionality.
node-websqlrequiredWebSQL implementation for Node.js that this adapter wraps.
Agent activity
7 hits · last 30 days
node
6
Resources
pouchdb-adapter-node-websql — npm install pouchdb-adapter-node-websql · libregistry