Parallelized transform streams for everyone!
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.editorconfig
.gitignore
.jscsrc
.travis.yml
LICENSE
README.md
index.js
package.json

README.md

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.