Skip to content

IndigoUnited/node-swift-transform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

swift-transform

NPM version Downloads Build Status Coverage Status Dependency status Dev Dependency status Greenkeeper badge

Parallelized transform streams for everyone!

NOTE: Order is not guaranteed!

Installation

$ npm install swift-transform

Usage

The swift transform stream is a drop-in replacement to nodejs TransformStream and adds a concurrency option that allows you to control the number of concurrent transformations.

var SwiftTransformStream = require('swift-transform').Transform;

function MyTransformStream() {
    SwiftTransformStream.call(this, { objectMode: true, concurrency: 5 });
}

util.inherits(MyTransformStream, SwiftTransformStream);

// ------------------------------------

MyTransformStream.prototype._transform = function (data, encoding, callback) {
    // ..
};

MyTransformStream.prototype._flush = function (callback) {
    // ..
};

module.exports = MyTransformStream;

In cases you have a transform stream which you do not own but want to parallelize it:

var swiftTransform = require('swift-transform');

readableStream
.pipe(swiftTransform(transformStream, 10))
.pipe(writableStream);

Tests

$ npm test
$ npm test-cov to get coverage report

License

Released under the MIT License.

About

Parallelized transform streams for everyone!

Resources

License

Stars

Watchers

Forks

Packages

No packages published