Flood
Usage
npm i -S @joemccann/flood
const flood = require('@joemccann/flood')
const data = {
batchSize: 50, // The number of simultaneous requests...
done: (data) => {
// write to file or console.dir(data)
// Data is an array of objects of type {data: [...], url: 'http://...'}
},
errorHandler: (e, results) => {
console.error(e)
// do something with the results maybe?
},
sleepTime: 100, // sleep in between batches, not each request; in milliseconds
url: `http://localhost:8080/api/foo?id={iteration}`, // {iteration} is REQUIRED
values: ['a','b','c'] // the value to update on the query string
}
try{
const { data, err } = await flood(data)
console.dir(data) // data is the same data passed into done()
} catch(e) {
console.error(e)
}
NOTE: The retries will go on forever so be wise about how you handle the errors.
Tests
npm i -D
npm test
Authors
LICENSE
MIT