@cluelesscoders/request-pool
TypeScript icon, indicating that this package has built-in type declarations

0.2.5 • Public • Published

Request Pool

Creates a pool of request.

Features

  • Axios based request pool
  • Support for all axios request types.

Example

import { RequestPool } from '@cluelesscoders/request-pool';

const targets = [
    { url: 'http://testurl1/', method: 'GET' },
    { url: 'http://testurl2/', method: 'GET' },
    { url: 'http://testurl3/', method: 'POST', data: { test: 'data' } },
];

// limit two request at a time
const poolSize = 2;

const reqPool = new RequestPool(targets, poolSize);

// Get all responses including the failures
const responses = await reqPool.start();

Package Sidebar

Install

npm i @cluelesscoders/request-pool

Weekly Downloads

1

Version

0.2.5

License

MIT

Unpacked Size

22.5 kB

Total Files

14

Last publish

Collaborators

  • coolguy1990
  • john-e