# orderable

> Readable stream to which you can push chunks at an index

Latest version **1.1.3** (published 2014-12-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install orderable
pnpm add orderable
yarn add orderable
bun add orderable
```

## 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.1.3 |
| Published | 2014-12-01 |
| First published | 2014-11-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Maintainers | juliangruber |

## Links

- npm: https://www.npmjs.com/package/orderable
- Repository: https://github.com/micnews/orderable
- Issues: https://github.com/micnews/orderable/issues
- npm.io page: https://npm.io/package/orderable

## Dependencies (1)

- [stream-read](https://npm.io/package/stream-read.md) ^1.0.1

## Recent versions

- 1.1.3 (latest) — 2014-12-01
- 1.1.2 — 2014-12-01
- 1.1.1 — 2014-11-29
- 1.1.0 — 2014-11-29
- 1.0.0 — 2014-11-13

## README

# orderable

  A readable stream to which you can in random order push chunks or sub-streams with an index, and they will be emitted by index ascending.

  [![build status](https://secure.travis-ci.org/micnews/orderable.svg)](http://travis-ci.org/micnews/orderable)

## Example

```js
var Orderable = require('orderable');

var o = Orderable();

setTimeout(function(){
  o.set(0, 'foo\n');
}, Math.random() * 1000);

setTimeout(function(){
  o.set(1, createStringStream(['b', 'a', 'r', '\n']));
}, Math.random() * 1000);

setTimeout(function(){
  o.set(2, 'baz\n');
  o.set(3, null);
}, Math.random() * 1000);

o.pipe(process.stdout);
```

  Always outputs:

```bash
$ node example.js
foo
bar
baz
$
```

## Installation

```bash
$ npm install orderable
```

## API

### Orderable()

  Create an orderable stream.

### Orderable#set(index, chunk)

  Push `chunk` onto the internal buffer at `index`. Pass `chunk=null` to mark the end of a stream. You can pass readable streams as well.

  You can also do this at the beginning, like:

```js
o.set(3, null);
o.set(0, 'foo');
o.set(1, 'bar');
o.set(2, 'baz');
```

## License

  MIT

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