open-index/open-npm huggingface dataset:
npm package: @joemccann/flood
Description: 🌊 Flood a network with requests in batches with retries.
Latest version: 1.0.0

# Flood

🌊 Flood a network with requests in batches with retries.

## Usage

```sh
npm i -S @joemccann/flood
```

```js
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

```sh
npm i -D
npm test
```

## Authors

- [Joe McCann](https://twitter.com/joemccann)
   
## LICENSE

MIT