1.1.0 • Published 4 years ago

ndjson-to-observable v1.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

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.