Registry / database / redis-rstream

redis-rstream

JSON →
library1.0.1jsnpmunverified

redis-rstream is a Node.js read stream that streams binary or UTF-8 data in chunks from a Redis key using an existing Redis client. It implements the streams2 interface (Node >=0.10) and uses the GETRANGE command to read data in configurable chunk sizes (default 64KB). It supports optional range streaming via startOffset/endOffset. It requires a Redis client that supports getrange and can return Buffers (e.g., node_redis with detect_buffers). Version 1.0.1 is stable but not actively maintained; last updated in 2015. Key differentiator: uses an existing client connection rather than opening a separate Redis connection, which avoids authentication/connection overhead. However, it is superseded by more modern streaming approaches and the package may be unmaintained.

npm install redis-rstream
INSTALL
IMPORT
SIG · REDIS-RSTREAM
R
redis-rstream
databasejavascriptv1.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.

redisRStream
const redisRStream = require('redis-rstream');
import redisRStream from 'redis-rstream';
This package is CJS-only and does not support ES modules. Use require().
redisRStream
redisRStream(client, key, { chunkSize: 65536 })
new redisRStream(client, key); // Not a constructor; it's a factory function.
The function is a factory that returns a stream instance; do not use 'new'.
RedisClient (from 'redis')
const client = require('redis').createClient(null, null, {detect_buffers: true});
const client = require('redis').createClient(); // Missing detect_buffers option → data may be strings not Buffers.
Without detect_buffers:true, GETRANGE returns string, causing incorrect binary data handling.

Creates a read stream from a Redis key and pipes it to stdout. Uses a custom chunk size and graceful cleanup.

const redis = require('redis'); const redisRStream = require('redis-rstream'); // Create a Redis client with detect_buffers enabled const client = redis.createClient(null, null, { detect_buffers: true }); // Stream a key to stdout const stream = redisRStream(client, 'mykey', { chunkSize: 32768 }); stream.pipe(process.stdout); // Handle errors stream.on('error', (err) => console.error(err)); stream.on('end', () => { client.quit(); });
Debug
Known issues
breakingThe package is not compatible with Node.js streams3 (Node >=10) due to the old streams2 API. It may produce unexpected behavior in modern Node versions.
fix
Use a modern streaming library like ioredis or build a custom stream using async iteration.
affects: >=10.0.0
deprecatedThis package has not been updated since 2015 and may contain unresolved bugs or security issues.
fix
Consider migrating to ioredis, which supports native streaming via the stream() method.
affects: >=1.0.0
gotchaThe Redis client must have `detect_buffers: true` (for node_redis) or otherwise return Buffers from getrange. Otherwise, binary data will be corrupted.
fix
Ensure client is created with { detect_buffers: true } or similar option for Buffer returns.
affects: >=0.0.1
gotchaThe stream does not support backpressure properly in some edge cases, potentially causing memory issues with large keys.
fix
Monitor memory usage and consider using a different library for very large Redis keys.
affects: >=0.0.1
breakingThe factory function throws if the client is not provided or is null. No type checking is done.
fix
Always pass a valid Redis client instance.
affects: >=0.0.1
Errors
Common errors & fixes
TypeError: redisRStream is not a function
Using ES module import on a CJS-only package.
fix
Use const redisRStream = require('redis-rstream'); instead of import.
TypeError: stream.on is not a function
The factory function may have returned something that is not a proper stream (e.g., invalid options).
fix
Ensure options are valid and client is properly connected. Check that you are not using 'new'.
Error: Redis connection failed - getrange ECONNREFUSED
Redis client is not connected or server is not running.
fix
Ensure Redis server is running and client connection is established before creating the stream.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
redisrequiredRequired peer dependency for the Redis client that implements getrange with Buffers.
hiredisoptionalOptional for improved performance with node_redis.
Agent activity
11 hits · last 30 days
node
8
Meta
1
Resources
redis-rstream — npm install redis-rstream · libregistry