easy-concurrent-stream

0.1.2 • Public • Published

EasyConcurrentStream

build status npm version Code Climate MIT License

Create concurrent transform stream from an asyncronous function.

How to use

Interface compatible with buildin stream.Transform https://nodejs.org/api/stream.html#stream_implementing_a_transform_stream

const Transform = require('easy-concurrent-stream').Transform;
 
const transform = new Transform({
  transform: function(chunk, encoding, callback) {
    async_function(chunk, function(data){
      callback(null, data);
    });
  },
  flush: function(callback) {
    // optionally
    // when remaining data has been flushed.
    callback();
  }
});

Readme

Keywords

Package Sidebar

Install

npm i easy-concurrent-stream

Weekly Downloads

0

Version

0.1.2

License

MIT

Unpacked Size

40.3 kB

Total Files

9

Last publish

Collaborators

  • ikeisuke