Registry / database / orbit-db-storage-adapter

orbit-db-storage-adapter

JSON →
library0.9.0jsnpmunverified

A wrapper for abstract-leveldown compliant stores, used by OrbitDB to manage persistent connections to levelup, level-js, or any abstract-leveldown compliant backend. Current stable version is 0.9.0. Maintained by the OrbitDB team, with low release cadence. Differentiators: it standardizes the creation and destruction of levelup stores for OrbitDB components like keystore and cache, and abstracts environment-specific stores (Node vs browser). Primarily an internal dependency for OrbitDB ecosystem packages.

npm install orbit-db-storage-adapter
INSTALL
IMPORT
SIG · ORBIT-DB-STORAGE-A
O
orbit-db-storage-adapter
databasejavascriptv0.9.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 (storageAdapter)
import storageAdapter from 'orbit-db-storage-adapter'
const storageAdapter = require('orbit-db-storage-adapter')
ESM-only since v0.9.0; CommonJS require() will break
storageAdapter (named)
import { storageAdapter } from 'orbit-db-storage-adapter'
Named export is not available; only default export exists
createStore method
const store = await storage.createStore(location, levelupOptions)
const store = storage.createStore(location)
createStore returns a Promise, must be awaited; second argument can be omitted if no options

Demonstrates creating a storage adapter with leveldown, creating a store, performing get/put, and cleanup.

import leveldown from 'leveldown'; import storageAdapter from 'orbit-db-storage-adapter'; async function main() { const storage = storageAdapter(leveldown); const store = await storage.createStore('./orbitdb/test'); await store.put('key', 'value'); const val = await store.get('key'); console.log('Value:', val); await store.close(); await storage.destroy(store); } main();
Debug
Known issues
breakingESM-only: default export, not CommonJS compatible since v0.9.0
fix
Use import statement or dynamic import; do not use require().
affects: >=0.9.0
deprecatedorbit-db-storage-adapter is outdated; OrbitDB now uses a custom cache implementation
fix
Consider migrating to orbit-db-cache or directly using levelup/level-js.
affects: *
gotchastore.createStore returns a Promise; must be awaited
fix
Use await or .then() when calling createStore.
affects: *
gotchaLeveldown must be installed separately; not a bundled dependency
fix
Install leveldown (or another abstract-leveldown store) alongside this package.
affects: *
gotchaOptions object passed to storageAdapter is for leveldown, not levelup
fix
Pass levelup-specific options as second argument to createStore.
affects: *
Errors
Common errors & fixes
TypeError: storageAdapter is not a function
Using require() on an ESM-only module
fix
Change to import storageAdapter from 'orbit-db-storage-adapter'
Error: No leveldown/level-js/location-db installed
Missing abstract-leveldown store
fix
Install leveldown (or memdown/level-js) and pass it to storageAdapter
TypeError: store.get is not a function
Not awaiting createStore (store is a Promise)
fix
Add await: const store = await storage.createStore(...)
Upgrade
Version history
0.9.0latest on npm
Audit
Dependencies
leveldownoptionalUsed as an example store; users typically install one leveldown-compatible store
Agent activity
12 hits · last 30 days
node
10
Amazon
1
Resources
orbit-db-storage-adapter — npm install orbit-db-storage-adapter · libregistry