Registry / database / redis-streams

redis-streams

JSON →
library1.1.0jsnpmunverified

Redis streams extension for the node_redis client, providing Readable and Writable stream interfaces for Redis keys. Version 1.1.0, last updated in 2016, with no recent releases. Unlike manual streaming, it avoids buffering entire datasets in memory by leveraging redis-rstream and redis-wstream. Provides readStream, writeStream, and writeThrough methods. Not compatible with ioredis or newer redis clients.

npm install redis-streams
INSTALL
IMPORT
SIG · REDIS-STREAMS
R
redis-streams
databasejavascriptv1.1.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.

require('redis-streams')
require('redis-streams')(redis)
const redisStreams = require('redis-streams')
Must be invoked as a function passing the redis module to extend the client prototype.
readStream
client.readStream(key)
redis.readStream(key)
Available on a RedisClient instance after calling require('redis-streams')(redis).
writeStream
client.writeStream(key, maxAge)
writeStream(key)
Method on RedisClient; maxAge in seconds, optional.
writeThrough
client.writeThrough(key, maxAge)
client.writeThrough(key)
Returns a Transform stream that writes to Redis and passes data through.

Demonstrates extending the redis client and using readStream/writeStream.

const redis = require('redis'); require('redis-streams')(redis); const client = redis.createClient(); const key = 'mystream'; client.writeStream(key, 60).write('data'); client.readStream(key).on('data', console.log);
Debug
Known issues
deprecatedPackage uses the deprecated node_redis package. Redis client version <4.0.
fix
Migrate to ioredis or redis@4+ and use their built-in stream support.
affects: >=1.0.0
breakingMust call the required module as a function with redis client. Forgetting this causes 'readStream is not a function'.
fix
Ensure require('redis-streams')(redis) is called after requiring redis.
affects: >=1.0.0
gotchaMaximumAge (maxAge) in writeStream is in seconds, not milliseconds.
fix
Convert milliseconds to seconds (divide by 1000) when passing maxAge.
affects: >=1.0.0
gotchaDoes not work with ioredis or other Redis clients. Only node_redis.
fix
Use ioredis-streams or alternative packages if using ioredis.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: redisClient.readStream is not a function
Forgot to call require('redis-streams')(redis) to extend the client prototype.
fix
Add require('redis-streams')(redis); after requiring redis.
Error: Redis connection to 127.0.0.1:6379 failed
Redis server not running or connection refused.
fix
Start Redis server or check connection settings.
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies
redisrequiredpeer dependency; extends the node_redis client prototype
Agent activity
20 hits · last 30 days
node
16
Meta
1
Amazon
1
Resources
redis-streams — npm install redis-streams · libregistry