# duplex-json-stream

> Turn a transport stream into an object stream that parses from / serializes to json

Latest version **1.0.1** (published 2015-10-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install duplex-json-stream
pnpm add duplex-json-stream
yarn add duplex-json-stream
bun add duplex-json-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.1 |
| Published | 2015-10-08 |
| First published | 2015-10-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 44 |
| Author | Mathias Buus |
| Maintainers | mafintosh |

## Links

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

## Dependencies (2)

- [ndjson](https://npm.io/package/ndjson.md) ^1.4.2
- [pumpify](https://npm.io/package/pumpify.md) ^1.3.3

## Recent versions

- 1.0.1 (latest) — 2015-10-08
- 1.0.0 — 2015-10-08

## README

# duplex-json-stream

Turn a transport stream into an duplex stream that parses from / serializes to json

```
npm install duplex-json-stream
```

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

## Usage

``` js
var jsonStream = require('duplex-json-stream')
var net = require('net')

var server = net.createServer(function (socket) {
  socket = jsonStream(socket) // turn the transport stream into an object stream
  socket.on('data', function (data) {
    socket.write({echo: data}) // echo back the messages
  })
})

server.listen(10000)

var client = jsonStream(net.connect(10000))

client.write({hello: 'world'})
client.on('data', function (data) {
  console.log(data) // will print {echo: {hello: 'world'}}
})
```

## License

MIT

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