# multi-threaded-queue

> Pure Javascript, simple multi-thread queue simulation.

Latest version **1.2.0** (published 2018-02-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install multi-threaded-queue
pnpm add multi-threaded-queue
yarn add multi-threaded-queue
bun add multi-threaded-queue
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2018-02-14 |
| First published | 2016-04-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 46.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Prabhath De Silva |
| Maintainers | prabhathkm |

## Links

- npm: https://www.npmjs.com/package/multi-threaded-queue
- Repository: https://github.com/prabhathkm/multi-threaded-queue
- Homepage: https://github.com/prabhathkm/multi-threaded-queue#readme
- Issues: https://github.com/prabhathkm/multi-threaded-queue/issues
- npm.io page: https://npm.io/package/multi-threaded-queue

## Recent versions

- 1.2.0 (latest) — 2018-02-14
- 1.1.0 — 2016-10-08
- 1.0.3 — 2016-09-30
- 1.0.2 — 2016-04-07
- 1.0.1 — 2016-04-06
- 1.0.0 — 2016-04-06

## README

# multi-threaded-queue
Pure Javascript, simple multi-threaded queue simulation for nodejs

![diagram](https://raw.githubusercontent.com/prabhathkm/multi-threaded-queue/master/diagram.png "Diagram")


## Usage
```javascript
var multiThreadedQueue = require('multi-threaded-queue');
var queue = new multiThreadedQueue(size, opt);
```
* size: no of simultaneous threads
* opt: { ..optional.. }
 * autoStart: true,  // enable/disable auto start on object insertion, good to use with continuous queue insertion
 * executeFunction: function(obj,next){ .... }, // shorthand for execute function, def. same as below
 * completeFunction: function(){ ... } // shorthand for complete function, def. same as below

```javascript
// on each object
queue.setExecuteFunction(function(obj,next){
    // perform tasks with picked obj from queue
    .......

    // move to the next on the queue
    next();
});


// on completion
queue.setCompleteFunction(function(){
    // triggered on queue completion
    .......
});

// add objects to the queue
queue.addToQueue(obj);
queue.addToQueue(obj);
.......
queue.addToQueue(obj);

// start processing the queue (not needed if autoStart enabled)
queue.start();
```


## Tests
npm test


## Release History
* 1.0.0 Initial release
* 1.1.0 Optimizations
* 1.2.0 GetQueueSize implemented

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