# multi-sort-stream

> merge multiple sorted streams into a single sorted stream

Latest version **1.0.4** (published 2022-07-04) · bsd license · 0 weekly downloads

## Install

```sh
npm install multi-sort-stream
pnpm add multi-sort-stream
yarn add multi-sort-stream
bun add multi-sort-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.4 |
| Published | 2022-07-04 |
| First published | 2022-06-18 |
| Weekly downloads | 0 |
| License | bsd |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | substack |

## Links

- npm: https://www.npmjs.com/package/multi-sort-stream
- npm.io page: https://npm.io/package/multi-sort-stream

## Recent versions

- 1.0.4 (latest) — 2022-07-04
- 1.0.3 — 2022-06-19
- 1.0.2 — 2022-06-19
- 1.0.1 — 2022-06-18
- 1.0.0 — 2022-06-18

## README

# multi-sort-stream

merge multiple sorted streams into a single sorted stream

# example

``` js
var multiSort = require('multi-sort-stream')
var { Readable, Transform, pipeline } = require('stream')
var a = Readable.from([5,10,15])
var b = Readable.from([3,20,50,55])
var c = Readable.from([17,25])

pipeline(
  multiSort([a,b,c], (a,b) => a < b ? -1 : +1),
  Transform({
    writableObjectMode: true,
    transform: (row,enc,next) => next(null, JSON.stringify(row)+'\n'),
  }),
  process.stdout,
  (err) => { if (err) console.error(err) }
)
```

output:

```
3
5
10
15
17
20
25
50
55
```

# api

``` js
var multiSort = require('multi-sort-stream')
```

## var stream = multiSort(streams, opts)

Create a readable `stream` of sorted output from an array of sorted readable `streams`.

* `opts.compare(a,b)` - comparison function (return -1 or +1)

If `opts` is a function, it will be used as the `opts.compare` function.

# install

```
npm install multi-sort-stream
```

# license

bsd

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