# interleave-stream

> Interleave multiple input streams into a single stream

Latest version **1.0.2** (published 2017-01-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install interleave-stream
pnpm add interleave-stream
yarn add interleave-stream
bun add interleave-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.2 |
| Published | 2017-01-27 |
| First published | 2017-01-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Gregor MacLennan |
| Maintainers | gmaclennan |
| Keywords | streams, interleave, multiple |

## Links

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

## Dependencies (3)

- [once](https://npm.io/package/once.md) ^1.4.0
- [from2](https://npm.io/package/from2.md) ^2.3.0
- [flush-write-stream](https://npm.io/package/flush-write-stream.md) ^1.0.2

## 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

- 1.0.2 (latest) — 2017-01-27
- 1.0.1 — 2017-01-26
- 1.0.0 — 2017-01-22

## README

# interleave-stream

[![npm](https://img.shields.io/npm/v/interleave-stream.svg)](https://www.npmjs.com/package/interleave-stream)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?maxAge=2592000)](http://standardjs.com/)

> Interleave multiple input streams into a single stream

Will emit chunks from input streams in order, e.g. `[s1chunk1, s2chunk1, s3chunk1, s1chunk2, s2chunk2, etc..]`. Use [split](https://www.npmjs.com/package/split2) or [block-stream2](https://github.com/substack/block-stream2) in order to control chunks from input streams.

## Install

```
npm install -S interleave-stream
```

## Usage

```js
var interleave = require('interleave-stream')
var split = require('split2')
var s1 = split()
var s2 = split()

interleave([s1, s2]).pipe(process.stdout)

s1.end('1\n2\n3')
s2.end('A\nB\nC')

// outputs `1A2B3C` to stdout
```

## API

```js
var interleave = require('interleave-stream')
```

### interleave(streams, opts)

Where:

- `streams` is an array of readable streams
- `opts` is the same as the options for [ReadableStream](https://nodejs.org/dist/latest-v6.x/docs/api/stream.html#stream_new_stream_readable_options)

Returns a ReadableStream that interleaves chunks from input streams in order.

### interleave.obj(streams, opts)

For objectMode streams.

## Contribute

PRs accepted.

Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.

## License

MIT © Gregor MacLennan

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