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

batch-flood-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

batch-flood-stream

emits batches of data events. grouped based on rate they are emitted and a max batch size.

  • 0.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

batch-flood-stream

emits batches of data events. grouped based on rate they are emitted and a max batch size.

var stream = batch(ondata,options);
  • ondata is optional
  • options are optional
    • size: defaults to 10000 uses data.length or if objects the number of objects
    • wait: defaults to 1000 ms
    • stats: off. if you pass a truthy value batch arrays will have a delay and a rate property.

  var s = batch({wait:5}).on('data',function(batch){
    console.log('data',batch);
  });

  var i = 0;
  var timer = setInterval(function(){
    s.write(++i);
    if(i == 50) {
      clearTimeout(timer);
      s.end();
    }
  },1);

outputs something like

data [ 1 ]
data [ 2 ]
data [ 3, 4 ]
data [ 5, 6, 7 ]
data [ 8 ]
data [ 9, 10, 11 ]
data [ 12, 13, 14, 15 ]
data [ 16, 17 ]
data [ 18, 19, 20 ]
data [ 21, 22, 23, 24 ]
data [ 25, 26 ]
data [ 27, 28, 29 ]
data [ 30, 31, 32 ]
data [ 33, 34, 35 ]
data [ 36, 37, 38, 39 ]
data [ 40, 41, 42 ]
data [ 43, 44, 45, 46 ]
data [ 47, 48, 49 ]

FAQs

Package last updated on 24 Apr 2014

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