A tiny but fully functional Promise based Redis Client for NodeJS

Use redisng instead
Last updated 5 years ago by steelbrain .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install redis-promise 
SYNC missed versions from official npm registry.


Redis-Promise is a redis client for io.js where You are the :tophat: boss. It's extremely lightweight, and allows you to freely choose between callbacks and promises. and not only that, Redis-Proto also triggers channel-specific subscription events, so you won't have to check for the channel in each of your listeners.


In your project root do

npm install redis-promise

or add it to your dependencies.

Using Promises

Using promises makes using Redis-Promise a piece of silky cake.

var Redis = require('redis-promise')
var Client = new Redis()
  console.log(Value) // Outputs the value or null
  Client.get('MyKey', 'InvalidOption').then(function(Value){}).catch(function(Error){
    console.log(Error) // [Error: ERR wrong number of arguments for 'get' command]

Using Callbacks

If you don't like the Promise overhead and want a plain callback API. Redis-Promise has got you covered!

var Redis = require('redis-promise')
var Client = new Redis()
Client.connect("localhost", 6379, function(){
  Client.get("myKey", function(Error, Value){
    console.log(Error) // null
    console.log(Value) // a string or null value
  Client.get("myKey", "invalidArg", function(Error, Value){
    console.log(Error) // [Error: ERR wrong number of arguments for 'get' command]
    console.log(Value) // null


Almost all of the Redis API Clients support Pub/Sub, but I haven't come across a single one that supports them beautifully, like Redis-Promise does.

var Redis = require('./Main');
var Subscriber = new Redis();
var Client = new Redis()
  Subscriber.on('message:chan1', function(Message){
    console.log(Message) // I am chan1
  Subscriber.on('message:chan2', function(Message){
    console.log(Message) // I am chan2
  Subscriber.on('message', function(Channel, Message){
    console.log(Channel, Message) // prints both of the values above
  Client.publish("chan1", "I am chan1")
  Client.publish("chan2", "I am chan2")


class Redis extends EventEmitter{
  connect(Host = '', Port = 6379, ?Callback)
  ref() // See Node's net.Socket ref documentation
  unref() // See Node's net.Socket unref documentation
  close() // Force Close the socket, use quit() for graceful shutdown
  ... All the Redis functions ...


This project is licensed under the terms of MIT license. See the License file for more info.

Current Tags

  • 0.1.0                                ...           latest (5 years ago)

2 Versions

  • 0.1.0 [deprecated]           ...           5 years ago
  • 0.0.1 [deprecated]           ...           5 years ago
Maintainers (1)
Today 0
This Week 1
This Month 3
Last Day 0
Last Week 2
Last Month 1
Dependencies (1)
Dev Dependencies (0)

Copyright 2014 - 2016 © |