# ordered-read-streams

> Combines array of streams into one Readable stream in strict order.

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

## Install

```sh
npm install ordered-read-streams
pnpm add ordered-read-streams
yarn add ordered-read-streams
bun add ordered-read-streams
```

## 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.0.0 |
| Published | 2022-10-10 |
| First published | 2014-01-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 10.13.0 |
| Dependencies | 1 |
| Unpacked size | 7.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Gulp Team |
| Maintainers | yocontra, phated |
| Keywords | streams, ordered, group, combine, streamx, readable |

## Links

- npm: https://www.npmjs.com/package/ordered-read-streams
- Repository: https://github.com/gulpjs/ordered-read-streams
- Homepage: https://github.com/gulpjs/ordered-read-streams#readme
- Issues: https://github.com/gulpjs/ordered-read-streams/issues
- npm.io page: https://npm.io/package/ordered-read-streams

## Dependencies (1)

- [streamx](https://npm.io/package/streamx.md) ^2.12.5

## Recent versions

- 2.0.0 (latest) — 2022-10-10
- 1.0.1 — 2017-05-09
- 1.0.0 — 2016-09-13
- 0.3.0 — 2015-07-04
- 0.2.0 — 2015-03-02
- 0.1.0 — 2014-09-30
- 0.0.8 — 2014-07-01
- 0.0.7 — 2014-01-18
- 0.0.6 — 2014-01-18
- 0.0.5 — 2014-01-18
- 0.0.4 — 2014-01-17
- 0.0.3 — 2014-01-16
- 0.0.2 — 2014-01-15
- 0.0.1 — 2014-01-15

## README

<p align="center">
  <a href="https://gulpjs.com">
    <img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
  </a>
</p>

# ordered-read-streams

[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url]

Combines array of streams into one Readable stream in strict order.

## Usage

```js
var { Readable } = require('streamx');
var ordered = require('ordered-read-streams');

var s1 = new Readable({
  read: function (cb) {
    var self = this;
    if (self.called) {
      self.push(null);
      return cb(null);
    }
    setTimeout(function () {
      self.called = true;
      self.push('stream 1');
      cb(null);
    }, 200);
  },
});
var s2 = new Readable({
  read: function (cb) {
    var self = this;
    if (self.called) {
      self.push(null);
      return cb(null);
    }
    setTimeout(function () {
      self.called = true;
      self.push('stream 2');
      cb(null);
    }, 30);
  },
});
var s3 = new Readable({
  read: function (cb) {
    var self = this;
    if (self.called) {
      self.push(null);
      return cb(null);
    }
    setTimeout(function () {
      self.called = true;
      self.push('stream 3');
      cb(null);
    }, 100);
  },
});

var readable = ordered([s1, s2, s3]);
readable.on('data', function (data) {
  console.log(data);
  // Logs:
  // stream 1
  // stream 2
  // stream 3
});
```

## API

### `ordered(streams, [options])`

Takes an array of `Readable` streams and produces a single `OrderedReadable` stream that will consume the provided streams in strict order. The produced `Readable` stream respects backpressure on itself and any provided streams.

#### `orderedReadable.addSource(stream)`

The returned `Readable` stream has an `addSource` instance function that takes appends a `Readable` stream to the list of source streams that the `OrderedReadable` is reading from.

## License

MIT

<!-- prettier-ignore-start -->
[downloads-image]: https://img.shields.io/npm/dm/ordered-read-streams.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/ordered-read-streams
[npm-image]: https://img.shields.io/npm/v/ordered-read-streams.svg?style=flat-square

[ci-url]: https://github.com/gulpjs/ordered-read-streams/actions?query=workflow:dev
[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/ordered-read-streams/dev?style=flat-square

[coveralls-url]: https://coveralls.io/r/gulpjs/ordered-read-streams
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/ordered-read-streams/master.svg?style=flat-square
<!-- prettier-ignore-end -->

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