# promise-barrier

> Exposes a promise barrier with pool options

Latest version **2.1.0** (published 2016-08-19) · UNLICENSED license · 0 weekly downloads

## Install

```sh
npm install promise-barrier
pnpm add promise-barrier
yarn add promise-barrier
bun add promise-barrier
```

## 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 | 2.1.0 |
| Published | 2016-08-19 |
| First published | 2015-12-29 |
| Weekly downloads | 0 |
| License | UNLICENSED |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Eoin Groat |
| Maintainers | gaussflayer |

## Links

- npm: https://www.npmjs.com/package/promise-barrier
- Repository: https://github.com/egroat/promise-barrier
- Homepage: https://github.com/egroat/promise-barrier#readme
- Issues: https://github.com/egroat/promise-barrier/issues
- npm.io page: https://npm.io/package/promise-barrier

## Dependencies (2)

- [uncomplicated-pool](https://npm.io/package/uncomplicated-pool.md) ^1.1.0
- [uncomplicated-barrier](https://npm.io/package/uncomplicated-barrier.md) ^1.0.1

## Recent versions

- 2.1.0 (latest) — 2016-08-19
- 2.0.2 — 2016-08-19
- 2.0.1 — 2016-08-19
- 2.0.0 — 2016-08-19
- 1.0.2 — 2015-12-29
- 1.0.1 — 2015-12-29
- 1.0.0 — 2015-12-29

## README

# Promise-Barrier

This barrier returns a Promise and can operate as a pool.

# Interface

    const Barrier = require('promise-barrier')
        , myData = [ '/home/egroat', '/etc/', '/srv' ]
        , poolSize = 2

    function myTask(datum) {
      return new Promise((pass, fail) => {
         // Some async task here,  e.g
         fs.readdir(datum, 'utf8', (err, files) => {
            err ? fail(err) : pass(files)
         })
      })
    }

    // Pool size is optional.  Unspecified it is infinite
    Barrier(myTask, myData, poolSize)
        .then((results) => {
            // Nothing went wrong
            console.log("Correct:", results)
        })
        .catch((data) => {
            // Some failed
            console.log("Correct:", data.results)
            console.error("Failures:", data.errors)
        })

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