Skip to content

Return a node.js api readable stream from list elements.

License

Notifications You must be signed in to change notification settings

madsquare/redis-stream-range

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

redis-stream-range

version download

Return a node.js api readable stream from list elements.

Usage

var redis = require('redis');
var es = require('event-stream');
var RedisStreamRange = require('..');

var stream = new RedisStreamRange(
    redis.createClient(),
    'hippo2390461',
    {
        chunkSize: 10,
        delimiter: "\n",
        autoClose: true
    }
);

stream.on('data', function(chunk) {
    console.log(chunk);
})
stream.on('end', function(length) {
    console.log('length: ', length);
});

stream
    .pipe(es.split())
    .pipe(es.map(function(data, cb) {
        console.log(data);
        cb(null, data);
    }));

Dependencies

Methods

var stream = new RedisStreamRange(redis.createClient(), 'list name');
stream.pipe(process.stdout);

new RedisStreamRange(client, list, [opt])

Return an instance of stream.

  • client: redis client instance
  • list: list name
  • [opt]: extra option
  • chunkSize: default 10
  • delimiter: default \n
  • autoClose: default true (close redis connection)

LICENSE

redis-stream-range is licensed under the MIT license.

About

Return a node.js api readable stream from list elements.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%