# http-request-queue

> Wrapper for request.js that limits the amount of concurrent requests.

Latest version **0.1.0** (published 2016-11-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install http-request-queue
pnpm add http-request-queue
yarn add http-request-queue
bun add http-request-queue
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2016-11-21 |
| First published | 2016-11-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Johnathan Howell |
| Maintainers | johnathanhowell |

## Links

- npm: https://www.npmjs.com/package/http-request-queue
- Repository: https://github.com/johnathanhowell/http-request-queue
- Homepage: https://github.com/johnathanhowell/http-request-queue#readme
- Issues: https://github.com/johnathanhowell/http-request-queue/issues
- npm.io page: https://npm.io/package/http-request-queue

## Dependencies (1)

- [request](https://npm.io/package/request.md) ^2.79.0

## Recent versions

- 0.1.0 (latest) — 2016-11-21

## README

# http-request-queue

http-request-queue is a small module used to limit the number of concurrent, "in-flight", http requests. It wraps the popular [request.js](https://github.com/request/request) javascript HTTP request library. This was built for [Sia-UI](https://github.com/NebulousLabs/Sia-UI) to manage a large number of concurrent API requests on systems with very low file descriptor limits (macOS defaults at 256!).

http-request-queue exposes a default function which takes one parameter, limit, which determines how many requests are allowed to run concurrently. If this limit is reached and another request is made, the additional request will be delayed until the current number of in flight requests dips below the limit.

## Example Usage

```js
import rqueue from 'http-request-queue'

// create a request queue with a maximum of 10 concurrent requests
const queue = rqueue(10)

// make a request using the new request queue. request takes a normal
// request.js `opts` parameter, which can be an object or a string. See the
// upstream request.js documentation for more information. request returns a
// promise which can be used directly, or with async/await.
queue.request('http://localhost/foo')
	.then((res) => {
		// res is an object containing the fields { response, body }
		console.log(res.body)
		console.log(res.response)
	})
	.catch((err) => {
		// do something with err
	})

```

## License

The MIT License (MIT)

---
_Source: https://npm.io/package/http-request-queue · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
