ndjson-to-observable
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

ndjson-to-observable CI

Transform a NDJSON stream to an RxJS observable stream.

Requirements

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.

Package Sidebar

Install

npm i ndjson-to-observable

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

2.83 kB

Total Files

4

Last publish

Collaborators

  • simonja