# proc-stream

> Get process output as a single stream

Latest version **0.1.1** (published 2016-12-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install proc-stream
pnpm add proc-stream
yarn add proc-stream
bun add proc-stream
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2016-12-10 |
| First published | 2016-12-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Diego Guerra |
| Maintainers | dgoguerra |
| Keywords | process, output, stream |

## Links

- npm: https://www.npmjs.com/package/proc-stream
- Repository: https://github.com/dgoguerra/proc-stream
- Issues: https://github.com/dgoguerra/proc-stream/issues
- npm.io page: https://npm.io/package/proc-stream

## Dependencies (4)

- [extend](https://npm.io/package/extend.md) ^3.0.0
- [split2](https://npm.io/package/split2.md) ^2.1.0
- [through2](https://npm.io/package/through2.md) ^2.0.3
- [merge-stream](https://npm.io/package/merge-stream.md) ^1.0.1

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

- 0.1.1 (latest) — 2016-12-10
- 0.1.0 — 2016-12-09

## README

proc-stream
===========

Get process output as a single stream.

This package splits a process's stdout and stderr into lines
and merges them into a single stream, to make it easy to print
its output with [debug](https://www.npmjs.com/package/debug)
or similar libraries.

Optionally stdout and stderr can be transformed line by line
before or after merging.

Installation
------------

```
npm install proc-stream
```

Usage
-----

```js
var procStream = require('proc-stream');

var proc = spawn('script.sh', []);

// basic usage, get stdout and stderr in a single stream
procStream(proc).pipe(process.stdout);

// decorate stderr and log with debug()
procStream(proc, {
  // show stderr lines in red
  stderr: function(chunk) {
    return chalk.red(chunk);
  },
  // transform both stdout and stderr
  both: function(chunk) {
    return 'cmd: '+chunk;
  },
  // do not add newlines after each line
  newline: null
}).on('data', function(data) {
  debug(data);
});

// decorate stdout, disable stderr and set a custom newline
var stream = procStream(proc, {
  // transform stdout
  stdout: function(chunk) {
    return chalk.green(chunk);
  },
  // disable stderr
  stderr: null,
  // custom newline (default is '\n')
  newline: '\r\n'
}).pipe(process.stdout);
```

License
-------
MIT license - http://www.opensource.org/licenses/mit-license.php

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