# through2-concurrent

> Like through2 except runs in parallel with limited concurrency

Latest version **2.0.0** (published 2018-08-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install through2-concurrent
pnpm add through2-concurrent
yarn add through2-concurrent
bun add through2-concurrent
```

## Health

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

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2018-08-10 |
| First published | 2014-10-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/through2-concurrent) |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 74 |
| Author | Thomas Parslow |
| Maintainers | almost |
| Keywords | through2, streams, streams2, through, transform, concurrency, parallel |

## Links

- npm: https://www.npmjs.com/package/through2-concurrent
- Repository: https://github.com/almost/through2-concurrent
- Homepage: https://github.com/almost/through2-concurrent#readme
- Issues: https://github.com/almost/through2-concurrent/issues
- npm.io page: https://npm.io/package/through2-concurrent

## Dependencies (1)

- [through2](https://npm.io/package/through2.md) ^2.0.0

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2018-08-10
- 1.1.1 — 2016-05-08
- 1.1.0 — 2015-06-17
- 1.0.0 — 2015-03-13
- 0.4.0 — 2015-02-25
- 0.3.1 — 2014-10-28
- 0.3.0 — 2014-10-22
- 0.2.0 — 2014-10-10
- 0.1.0 — 2014-10-10

## README

through2-concurrent
===================

[![NPM](https://nodei.co/npm/through2-concurrent.png?downloads&downloadRank)](https://nodei.co/npm/through2-concurrent/)

A simple way to create a Node.JS Transform stream which processes in
parallel. You can limit the concurrency (default is 16) and order is
*not* preserved (so chunks/objects can end up in a different order to
the order they started in if the transform functions take different
amounts of time).

Built using [through2](https://github.com/rvagg/through2) and has the
same API with the addition of a `maxConcurrency` option.

Non-`objectMode` streams are supported for completeness but I'm not
sure they'd be useful for anything.

Written by Thomas Parslow
([almostobsolete.net](http://almostobsolete.net) and
[tomparslow.co.uk](http://tomparslow.co.uk)) as part of Active Inbox
([activeinboxhq.com](http://activeinboxhq.com/)).

[![Build Status](https://travis-ci.org/almost/through2-concurrent.svg)](https://travis-ci.org/almost/through2-concurrent)


Install
-------

```bash
npm install --save through2-concurrent
```

Examples
--------

Process lines from a CSV in paralel. The order the results end up in
the `all` variable is not deterministic.

```javascript
var through2Concurrent = require('through2-concurrent');

var all = [];

fs.createReadStream('data.csv')
  .pipe(csv2())
  .pipe(through2Concurrent.obj(
    {maxConcurrency: 10},
    function (chunk, enc, callback) {
      var self = this;
      someThingAsync(chunk, function (newChunk) {
        self.push(newChunk);
        callback();
      });
  }))
  .on('data', function (data) {
    all.push(data)
  })
  .on('end', function () {
    doSomethingSpecial(all)
  })
```


Contributing
------------

Fixed or improved stuff? Great! Send me a pull request [through GitHub](http://github.com/almost/through2-concurrent)
or get in touch on Twitter [@almostobsolete][#tom-twitter] or email at tom@almostobsolete.net

[#tom]: http://www.almostobsolete.net
[#tom-twitter]: https://twitter.com/almostobsolete

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