# docker-raw-stream

> Decode/encode a docker raw stream

Latest version **1.3.1** (published 2016-02-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install docker-raw-stream
pnpm add docker-raw-stream
yarn add docker-raw-stream
bun add docker-raw-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.3.1 |
| Published | 2016-02-18 |
| First published | 2014-06-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Mathias Buus |
| Maintainers | mafintosh |
| Keywords | docker, raw, stream, encode, decode, logs, log, attach |

## Links

- npm: https://www.npmjs.com/package/docker-raw-stream
- Repository: https://github.com/mafintosh/docker-raw-stream
- Issues: https://github.com/mafintosh/docker-raw-stream/issues
- npm.io page: https://npm.io/package/docker-raw-stream

## Dependencies (1)

- [through2](https://npm.io/package/through2.md) ^0.5.1

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 1.3.1 (latest) — 2016-02-18
- 1.3.0 — 2014-07-10
- 1.2.0 — 2014-06-25
- 1.1.0 — 2014-06-21
- 1.0.0 — 2014-06-21

## README

# docker-raw-stream

Decode/encode a docker raw stream

```
npm install docker-raw-stream
```

[![build status](http://img.shields.io/travis/mafintosh/docker-raw-stream.svg?style=flat)](http://travis-ci.org/mafintosh/docker-raw-stream)

## Usage

docker raw streams multiplexes stdout/stderr to a single stream

``` js
var raw = require('docker-raw-stream')
var request = require('request')

var decode = raw.decode()

// forward the output to stdio
decode.stdout.pipe(process.stdout)
decode.stderr.pipe(process.stderr)

var url = 'http://docker-host:2375/containers/f7f65a63a595/attach?stderr=1&stdout=1&stream=1'
request.post(url).pipe(decode)
```

You can also use it encode a stream to the docker raw stream format

``` js
var encode = raw.encode()

// forward stdin to the stdout channel
process.stdin.pipe(encode.stdout)

encode.pipe(someWritableStream)
```

Per default if you end either `encode.stdout` or `encode.stderr` the encode stream will end.
If you want to have the encode stream be half open use `raw.encode({halfOpen:true})`.
This will require both `encode.stdout` and `encode.stderr` to end before the encode stream ends.

## License

MIT

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