Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

parallel-transform

Package Overview
Dependencies
3
Maintainers
1
Versions
11
Issues
File Explorer

Advanced tools

parallel-transform

Transform stream that allows you to run your transforms in parallel without changing the order

    1.2.0latest

Version published
Maintainers
1
Weekly downloads
8,958,644
decreased by-10.51%

Weekly downloads

Readme

Source

parallel-transform

Transform stream for Node.js that allows you to run your transforms in parallel without changing the order of the output.

npm install parallel-transform

It is easy to use

var transform = require('parallel-transform'); var stream = transform(10, function(data, callback) { // 10 is the parallism level setTimeout(function() { callback(null, data); }, Math.random() * 1000); }); for (var i = 0; i < 10; i++) { stream.write(''+i); } stream.end(); stream.on('data', function(data) { console.log(data); // prints 0,1,2,... }); stream.on('end', function() { console.log('stream has ended'); });

If you run the above example you'll notice that it runs in parallel (does not take ~1 second between each print) and that the order is preserved

Stream options

All transforms are Node 0.10 streams. Per default they are created with the options {objectMode:true}. If you want to use your own stream options pass them as the second parameter

var stream = transform(10, {objectMode:false}, function(data, callback) { // data is now a buffer callback(null, data); }); fs.createReadStream('filename').pipe(stream).pipe(process.stdout);

Unordered

Passing the option {ordered:false} will output the data as soon as it's processed by a transform, without waiting to respect the order.

License

MIT

Keywords

FAQs

What is parallel-transform?

Transform stream that allows you to run your transforms in parallel without changing the order

Is parallel-transform popular?

The npm package parallel-transform receives a total of 7,195,106 weekly downloads. As such, parallel-transform popularity was classified as popular.

Is parallel-transform well maintained?

We found that parallel-transform demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 05 Sep 2019

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc