Node Roundup: redis-stream, DataGen, Cushion
redis-stream
redis-stream (License: MIT, npm: redis-stream) by Thomas Blobaum is a stream-based wrapper around the Redis protocol. It’s actually an extremely lightweight module, but the author has included tests and some interesting examples. The standard Node stream methods work, so data can be piped:
var Redis = require('redis-stream')
, client = new Redis(6379, localhost, 0)
, rpop = client.stream('rpop');
rpop.pipe(process.stdout);
rpop.write('my-list-key');
This doesn’t just apply to rpop, other Redis commands will also work in a similar way.
DataGen
DataGen (GitHub: cliffano / datagen, License: MIT, npm: datagen) by Cliffano Subagio is a multi-process test data file generator. It can be used to generate files in various formats, including CSV and JSON, based on template files that describe the output. Random numbers, dates, and strings can be generated.
The underlying random data generation is based on the Faker library, and Mocha tests are included.
Cushion
Cushion (GitHub: Zoddy / cushion, License: MIT, npm: cushion) by André Kussmann is a CouchDB API. It has Node-friendly asynchronous wrappers around the usual CouchDB API methods, and it also supports low-level requests by calling cushion.request. Fetching documents returns a document object that can be modified and saved like this:
var doc = db.document('id');
doc.load(function(err, document) {
document.body({ name: 'Quincy' });
document.save();
});
Designs and users can also be fetched and manipulated.
