ndjson-to-observable
v1.1.0
Published
Create an observable stream from a ndjson stream
Downloads
19
Maintainers
Readme
ndjson-to-observable
Transform a NDJSON stream to an RxJS observable stream.
Requirements
- RxJS
- Node 8+
Install
$ npm install ndjson-to-observable
Usage
import * as fs from 'fs';
import * as path from 'path'
import {ndjsonToObservable} from 'ndjson-to-observable';
import {tap} from 'rxjs/operators'
const stream = fs.createReadStream(path.join(__dirname, 'test.json'));
ndjsonToObservable(stream)
.pipe(
tap(item => console.log(item)) // JSON object
)
.subscribe()
API
ndjsonToObservable(stream)
stream
Type: ReadableStream
Stream of NDJSON records. Could be from a file or generated ad hoc.