Socket
Socket
Sign inDemoInstall

parallel-write-stream

Package Overview
Dependencies
6
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    parallel-write-stream

Parallel Write Stream is an abstract class which helps create kind of passthrough stream. Regardless of how data will flow into your writable stream, the batch of tasks will be processed in parallel.


Version published
Weekly downloads
1
Maintainers
1
Install size
178 kB
Created
Weekly downloads
 

Readme

Source

parallel-write-stream

Parallel Write Stream is an abstract class which helps create kind of passthrough stream. Your have to implement _save method and operate with the object streams only.

Regardless of how data will flow into your writable stream, the batch of tasks will be processed in parallel.

Install

$ npm install --save parallel-write-stream

Usage

To implement parallel write stream, follow the pattern:

var util = require('util');
var ParallelWriteStream = require('parallel-write-stream');

var Updater = function () {
  ParallelWriteStream.call(this);
};
util.inherits(Updater, ParallelWriteStream);

Updater.prototype._save = function (doc, callback) {
  // implement procedure to save doc here
  // invoke callback then save will be done
  callback();
};

The size of the batch is specified in the options passed to constructor.

var update = new Updater({
  concurrency: 5
});

API

_save(doc, callback)

doc

The document you want to store, update or process in other way.

callback(err)

A function which is called when the processing is finished. First argument is the error.

License

MIT © 2015 Vladimir Kuznetsov

Keywords

FAQs

Last updated on 12 Jan 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc