You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 21, 2019. It is now read-only.
hiredis-node is deprecated, unmaintained and not updated in forever. Use node-redis.
hiredis-node
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 noticeable 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.
python 2.7 or any newer 2.x version. python 3.x is not supported.
For running on Travis check the bundled .travis.yml.
Contribute
To work on the code, first fetch the bundled hiredis submodule, then build hiredis and run the tests.
git submodule update --init
npm install
npm test
Usage
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:
varhiredis=require("hiredis"),reader=newhiredis.Reader();// Data comes inreader.feed("$5\r\nhello\r\n");// Reply comes outreader.get()// => "hello"
Instead of returning strings for bulk payloads, it can also return
buffers:
varhiredis=require("hiredis"),reader=newhiredis.Reader({return_buffers: true});// Data comes inreader.feed("$5\r\nhello\r\n");// Reply comes outreader.get()// => <Buffer 68 65 6c 6c 6f>
Windows
Since Version 0.3.0 hiredis-node officially supports Windows.
A simple npm install hiredis should just work.
If not, please open a bug report.
There's also a Windows fork by Dmitry Gorbunos (@fuwaneko), which should now be unnecessary.
License
This code is released under the BSD license, after the license of hiredis.