# ldjson-stream

> streaming line delimited json parser + serializer

Latest version **1.2.1** (published 2014-08-12) · BSD license · 0 weekly downloads

## Install

```sh
npm install ldjson-stream
pnpm add ldjson-stream
yarn add ldjson-stream
bun add ldjson-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.2.1 |
| Published | 2014-08-12 |
| First published | 2013-08-30 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 297 |
| Author | max ogden |
| Maintainers | maxogden |

## Links

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

## Dependencies (2)

- [split2](https://npm.io/package/split2.md) ^0.2.1
- [through2](https://npm.io/package/through2.md) ^0.6.1

## Recent versions

- 1.2.1 (latest) — 2014-08-12
- 1.2.0 — 2014-08-09
- 1.1.0 — 2014-06-17
- 1.0.0 — 2014-06-15
- 0.0.1 — 2013-08-30

## README

# ldjson-stream

#### streaming line delimited json parser + serializer

[![NPM](https://nodei.co/npm/ldjson-stream.png)](https://nodei.co/npm/ldjson-stream/)

## usage

```
var ldj = require('ldjson-stream')
```

#### ldj.parse()

returns a transform stream that accepts newline delimited json and emits objects

example newline delimited json:

`data.txt`:

```
{"foo": "bar"}
{"hello": "world"}
```

If you want to discard non-valid JSON messages, you can call `ldj.parse({strict: false})`

usage:

```js
fs.createReadStream('data.txt')
  .pipe(ldj.parse())
  .on('data', function(obj) {
    // obj is a javascript object
  })
```

#### ldj.serialize()

returns a transform stream that accepts json objects and emits newline delimited json

example usage:

```js
var serialize = ldj.serialize()
serialize.on('data', function(line) {
  // line is a line of stringified JSON with a newline delimiter at the end
})
serialize.write({"foo": "bar"})
serialize.end()
```

### license

BSD

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