# pressure-stream

> call an async function for each data event into through stream. manage concurrency as back pressure

Latest version **1.0.0** (published 2017-03-14) · 0 weekly downloads

## Install

```sh
npm install pressure-stream
pnpm add pressure-stream
yarn add pressure-stream
bun add pressure-stream
```

## 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.0.0 |
| Published | 2017-03-14 |
| First published | 2014-01-20 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | Ryan Day |
| Maintainers | soldair |

## Links

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

## Dependencies (2)

- [once](https://npm.io/package/once.md) ^1.4.0
- [through2](https://npm.io/package/through2.md) ^2.0.3

## Recent versions

- 1.0.0 (latest) — 2017-03-14
- 0.0.2 — 2014-01-20

## README

pressure-stream
====================

call an async function for each data event into through stream. manage concurrency as back pressure.


```js
var pressure = require('pressure-stream');
var split = require('split2');
var request = require('request');


var concurrency = 100  // never ever do more than 100 requests at a time.

process.stdin.pipe(split())
.pipe(pressure(function(data,cb){
  request(data,function(err,res,body){
    cb(err,body)
  });
},concurrency)).pipe(process.stdout);


```



API
===

pressure(fn,opts)
-----------------
  - fn is the data handler it is always called with 2 arguments
    - fn(data,cb)
  - when you are done with the the handler call cb(err,data)
    - if err is passed back with cb "error" will be emitted on the stream
    - data passed back on this stream will be emited as data


options
-------
  - concurrency
    - the maximum number of concurrent data handlers the stream will execute.
    - defaults to 10

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