# quu

> lightweight concurrent function queue

Latest version **0.5.0** (published 2024-10-30) · Unlicense license · 0 weekly downloads

## Install

```sh
npm install quu
pnpm add quu
yarn add quu
bun add quu
```

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

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

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.0 |
| Published | 2024-10-30 |
| First published | 2016-10-17 |
| Weekly downloads | 0 |
| License | Unlicense |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 0 |
| Unpacked size | 3.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | yetzt |
| Maintainers | yetzt |
| Keywords | queue, async, asynchronous, job, task, flow, concurrency, concurrent, quu |

## Links

- npm: https://www.npmjs.com/package/quu
- Repository: https://github.com/yetzt/node-quu
- Homepage: https://github.com/yetzt/node-quu#readme
- Issues: https://github.com/yetzt/node-quu/issues
- npm.io page: https://npm.io/package/quu

## Alternatives

- [cron](https://npm.io/package/cron.md) — 4.9M weekly downloads
- [@vercel/queue](https://npm.io/package/@vercel/queue.md) — 731.6K weekly downloads
- [create-sonicjs](https://npm.io/package/create-sonicjs.md) — 1.6K weekly downloads
- [@exellix/jobs-api](https://npm.io/package/@exellix/jobs-api.md) — 941 weekly downloads
- [@forwardimpact/libskill](https://npm.io/package/@forwardimpact/libskill.md) — 575 weekly downloads

## Recent versions

- 0.5.0 (latest) — 2024-10-30
- 0.4.3 — 2022-05-24
- 0.4.2 — 2022-04-05
- 0.4.1 — 2021-05-18
- 0.4.0 — 2021-04-12
- 0.3.0 — 2018-03-09
- 0.2.0 — 2016-11-01
- 0.1.0 — 2016-10-17

## README

# quu

`quu` is a simple and lightweigt function queue.

## Usage

### `quu(concurrency, wait)`

Create an instance of quu. Run `<int> concurrency` tasks at once, `<bool> wait` for `run()` to be called before starting any tasks.

### `q.push(function task(done){ done(err); })`

Add a task to the queue. Call `done()` when the task is done any `err` will be collected.

### `q.run([function complete(errors){  }])`

`complete` will be called, when all tasks are completed, with all `errors` collected.

When no callback is provided, `q.run()` returns a promise.

## Example

``` javascript

const quu = require("quu");

// create queue with a maximum concurrency of 5
const q = quu(5);

// add a task to the queue
q.push(done=>{

	// let's do heaps of async stuff...
	// look at all the stuff we are doing...
	// nearly finished... done.
	// phew! that was quite some work.
	// ok, lets wrap this up now!

	done();

});

// callback after tasks are complete
q.run((errors, completed)=>{
	if (errors) errors.forEach(console.error);

	// queue is empty

});

// or promise
const { errors, completed } = await q.run();

```

## Licence

[UNLICENSE](http://unlicense.org/UNLICENSE)

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