node package manager
We need your input. Help make JavaScript better: Take the 2017 JavaScript Ecosystem survey »


Build Status


Node extension that wraps hiredis. Because Node is already good at doing I/O, hiredis-node only provides bindings to the protocol parser. The hiredis protocol parser is faster than JavaScript protocol parsers, but the speedup only becomes noticable for large replies. If you use Redis for simple SET/GET operations, there won't be a big benefit to using hiredis. If you use Redis for big SUNION/SINTER/LRANGE/ZRANGE operations, the benefit to using hiredis-node can be significant.


Install with NPM:

npm install hiredis


hiredis-node works out of the box with Matt Ranney's node_redis. The latter has an optional dependency on hiredis-node, so maybe you're already using it without knowing.

Alternatively, you can use it directly:

var hiredis = require("hiredis"),
    reader = new hiredis.Reader();
// Data comes in 
// Reply comes out 
reader.get() // => "hello" 

Instead of returning strings for bulk payloads, it can also return buffers:

var hiredis = require("hiredis"),
    reader = new hiredis.Reader({ return_buffers: true });
// Data comes in 
// Reply comes out 
reader.get() // => <Buffer 68 65 6c 6c 6f> 


This code is released under the BSD license, after the license of hiredis.