csv-to-observable
v1.0.2
Published
Create an observable stream from a csv stream
Downloads
38
Readme
csv-to-observable
Transform a CSV stream to an RxJS observable stream. Wrapper around csv-parser
Requirements
- RxJS
- Node 8+
Install
$ npm install csv-to-observable
Usage
import * as fs from 'fs';
import * as path from 'path'
import csvToObservable from 'csv-to-observable';
import {tap} from 'rxjs/operators'
const stream = fs.createReadStream(path.join(__dirname, 'test.csv'));
csvToObservable(csvStream, { separator: ';' })
.pipe(
tap(item => console.log(item)) // JSON object
)
.subscribe()
API
csvToObservable(stream, options)
stream
Type: ReadableStream
Stream of CSV records. Could be from a file or generated yourself.
options
Type: Object
Same configuration options as defined in csv-parser. To see the default values, check the documentation of csv-parser