Socket
Book a DemoInstallSign in
Socket

basic-batch

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

basic-batch

Basic result batching to easily process results to database or an http endpoint in groups

Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

Basic Batch

The most basic of batches

It's Brittney Batch

Install

npm install --save basic-batch

Example

const BasicBatch = require('basic-batch');
const batch  = new BasicBatch(5);
batch.on('processReady', ({ items, done }) => { // wait for your queue to fill up
	setTimeout(() => {
		console.log(items); // get your items from the queue
		done(); // call this to let BasicBatch know you're done with this batch
	}, Math.random(1, 5) * 1000);
});

for(let i=0; i<100; i++) {
	batch.push(i); // filling our queue with some numbers to test
}

It's that basic

FAQs

Package last updated on 11 Aug 2021

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