Registry / database / redisdown

redisdown

JSON →
library0.1.12jsnpmunverified

RedisDOWN is a LevelDOWN-compatible adapter that allows LevelUP databases to use Redis as the storage backend. Version 0.1.12 is the latest release. It uses a sorted set for key ordering and a hash for values, with a single Lua call for iteration. Key differentiators include support for an external Redis client option, URL-based configuration (e.g., REDIS_URL, REDISCLOUD_URL), and passing the abstract-leveldown test suite except for implicit iterator snapshots. It requires Redis 2.8+ and Node 0.10+.

npm install redisdown
INSTALL
IMPORT
SIG · REDISDOWN
R
redisdown
databasejavascriptv0.1.12
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
const redisdown = require('redisdown')
import redisdown from 'redisdown'
Package uses CommonJS; ESM import may not work without bundler.
redisdown with levelup
const levelup = require('levelup'); const redisdown = require('redisdown'); const db = levelup('mydb', { db: redisdown, host: 'localhost', port: 6379 })
const db = redisdown('mydb')
redisdown returns a factory that expects a db option; direct open is possible but not typical.
destroy
const redisdown = require('redisdown'); redisdown.destroy('mydb', callback)
require('redisdown').destroy('mydb')
destroy is a static method; ensure to call it on the required object.

Demonstrates creating a LevelUP database with RedisDOWN backend, putting and getting a value.

const levelup = require('levelup'); const redisdown = require('redisdown'); const db = levelup('myapp', { db: redisdown, host: process.env.REDIS_HOST || 'localhost', port: process.env.REDIS_PORT || 6379 }); db.put('key', 'value', (err) => { if (err) return console.error('Put error:', err); db.get('key', (err, value) => { if (err) return console.error('Get error:', err); console.log('Retrieved:', value); db.close(); }); });
Debug
Known issues
gotchaImplicit iterator snapshot test fails: iteration does not guarantee a consistent snapshot of the data.
fix
Do not rely on iterator snapshot consistency; consider taking a snapshot manually.
affects: >=0.0.0
breakingRequires Redis 2.8+ due to Lua scripting and sorted set commands.
fix
Upgrade Redis server to version 2.8 or later.
affects: >=0.0.0
deprecatedUses node_redis (redis package v2.x) which is deprecated in favor of ioredis.
fix
Consider migrating to ioredis-based adapter if available, or pin redis package to v2.
affects: >=0.0.0
gotchaWhen using an existing Redis client via 'redis' option, redisdown does not manage connection lifecycle. You must close the client yourself.
fix
Explicitly close the Redis client after closing all redisdown instances.
affects: >=0.0.0
gotchaLocation keys are namespaced with ':h' and ':z' suffixes; destroying a location deletes all keys with those prefixes.
fix
Ensure location is unique to avoid accidental data loss.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Redis connection to 127.0.0.1:6379 failed
Redis server is not running or not accessible.
fix
Start Redis server: redis-server, or check host/port options.
TypeError: redisdown is not a function
Using ESM import (import redisdown from 'redisdown') instead of CommonJS require.
fix
Use const redisdown = require('redisdown').
TypeError: db.put is not a function
Calling levelup without passing the 'db' option correctly.
fix
const db = levelup('mydb', { db: redisdown })
Upgrade
Version history
0.1.12latest on npm
Audit
Dependencies
abstract-leveldownoptionalImplements the abstract-leveldown interface
leveluprequiredTypically used with levelup as the database wrapper
redisrequiredRedis client for connecting to Redis server
Agent activity
6 hits · last 30 days
node
6
Resources
redisdown — npm install redisdown · libregistry