Registry / database / redis-adapter

redis-adapter

JSON →
library0.2.0jsnpmunverified

Simple Redis client adapter with promises and chainable response transforms. Current stable version 0.2.0 (last updated 2019, no recent releases). Low-maintenance library providing a Redis wrapper with promise-based API, connection management with prefix support, and a unique chainable response modification system (map, filter, sort, paginate, etc.) on Redis command results. Unlike `redis` npm package, it does not support pub/sub or advanced features. Requires Node.js >=8.0.

npm install redis-adapter
INSTALL
IMPORT
SIG · REDIS-ADAPTER
R
redis-adapter
databasejavascriptv0.2.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 (constructor)
const Redis = require('redis-adapter');
import Redis from 'redis-adapter'; // Not ESM compatible
Package uses CommonJS only; no default export for ESM.
Redis (class)
const Redis = require('redis-adapter'); const client = new Redis({});
const { Redis } = require('redis-adapter'); // Named export does not exist
Export is the constructor itself, not a named property.
instance methods
client.connect().then(() => {});
Redis.connect() // No static method, must be instance
Methods are available only on instance after constructor.

Connects to Redis, fetches all members of a set, logs them, and closes connection.

const Redis = require('redis-adapter'); const client = new Redis({port: 6379, host: '127.0.0.1'}); client.connect() .then(() => { console.log('Connected!'); return client.call('smembers', 'blocks'); }) .then(blocks => { console.log('Blocks:', blocks); client.close(); }) .catch(err => { console.error('Error:', err); });
Debug
Known issues
gotchaNo pub/sub support; only basic Redis commands via 'call'.
fix
Use 'redis' directly if pub/sub or advanced features needed.
affects: >=0.1.0
gotchaIncomplete method chain after 'call' may cause runtime error if response is not array/object.
fix
Ensure response is iterable before using chain methods like map, filter, etc.
affects: >=0.1.0
gotchaDoes not handle connection errors internally; unhandled rejections may crash process.
fix
Always attach .catch() to connect() and all command promises.
affects: >=0.1.0
gotchaNo TypeScript definitions; types must be authored manually.
fix
Create a .d.ts file or use with JSDoc annotations.
affects: >=0.1.0
Errors
Common errors & fixes
Redis is not defined
Trying to import using ESM syntax or wrong require path.
fix
Use: const Redis = require('redis-adapter');
TypeError: client.connect is not a function
Using static call on class, not instance.
fix
Create instance: const client = new Redis({});
TypeError: blocks.map is not a function
Response is null or not iterable when chaining .map() after .call()
fix
Ensure Redis returns an array for that command, e.g., SMEMBERS.
Upgrade
Version history
0.2.0latest on npm
Audit
Dependencies
redisrequiredUnderlying Redis client
Agent activity
8 hits · last 30 days
node
6
Meta
1
Resources
redis-adapter — npm install redis-adapter · libregistry