Registry / database / then-redis

then-redis

JSON →
library2.0.1jsnpmunverified

Promise-based Redis client for Node.js, version 2.0.1. Built on top of node_redis, it provides a promise-based API for all Redis commands, automatic pipelining, and support for transactions and pub/sub. Requires Node >=4 and peer dependencies redis and redis-commands. Differentiates from ioredis by being lighter and directly wrapping node_redis; less active development.

npm install then-redis
INSTALL
IMPORT
SIG · THEN-REDIS
T
then-redis
databasejavascriptv2.0.1
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.

createClient
import { createClient } from 'then-redis'
import createClient from 'then-redis'
createClient is a named export, not a default export.
createClient (CommonJS)
const { createClient } = require('then-redis')
const createClient = require('then-redis')
The default export is an object, not a function. Use destructured require.
Client
import { Client } from 'then-redis' or type Client = ReturnType<typeof createClient>
The Client class is exported for type usage; typical use is via createClient which returns a Client instance.

Basic set and get operations with promise chaining.

import { createClient } from 'then-redis'; const client = createClient(); client.set('foo', 'bar') .then(() => client.get('foo')) .then(value => { console.log(value); // 'bar' }) .catch(err => { console.error(err); });
Debug
Known issues
gotchaRedis server version 2.6 or above required for promise-based HGETALL. Older versions may return different types.
fix
Update Redis server to 2.6+ or avoid HGETALL on older Redis versions.
affects: >=1.0.0
gotchaPeer dependencies redis and redis-commands must be installed manually. Missing them will cause runtime errors.
fix
Run 'npm install redis redis-commands' alongside then-redis.
affects: >=2.0.0
gotchaCommands that return objects (e.g., HGETALL) may return null for empty results, not an empty object.
fix
Check for null before accessing properties: const hash = await client.hgetall('key'); if (hash) { ... }
affects: >=1.0.0
deprecatedThe callback API via .end() is deprecated in node_redis; use .quit() instead.
fix
Use client.quit() to close connection gracefully.
affects: >=2.0.0
Errors
Common errors & fixes
Error: Cannot find module 'redis'
Missing peer dependency redis when using then-redis.
fix
Install peer dependencies: npm install redis redis-commands
TypeError: createClient is not a function
Default import of then-redis returns an object, not the function directly.
fix
Use named import: import { createClient } from 'then-redis' or const { createClient } = require('then-redis')
TypeError: db.hgetall(...).then is not a function
Using then-redis before Redis is ready (e.g., not awaiting connection).
fix
Await createClient() or use a promise for connection readiness (e.g., client.on('connect', ...)).
Upgrade
Version history
2.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
23 hits · last 30 days
node
20
Meta
1
Amazon
1
OpenAI (training)
1
Resources
then-redis — npm install then-redis · libregistry