Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

parallel-write-stream

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

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.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
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

Package last updated on 12 Jan 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc