https://github.com/koumoul-dev/mime-type-stream
Streaming parser + serializer for various mime-types
https://github.com/koumoul-dev/mime-type-stream
csv json ndjson parser serializer stream
Last synced: 16 days ago
JSON representation
Streaming parser + serializer for various mime-types
- Host: GitHub
- URL: https://github.com/koumoul-dev/mime-type-stream
- Owner: koumoul-dev
- License: mit
- Created: 2017-12-04T11:33:36.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T02:29:33.000Z (about 2 years ago)
- Last Synced: 2025-03-18T08:03:02.976Z (about 1 month ago)
- Topics: csv, json, ndjson, parser, serializer, stream
- Language: JavaScript
- Size: 11.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Streaming parser + serializer for various mime-types
This is mainly a meta package compiling various parsers and serializers to work with a stream of JSON objects.Support the following mime types :
* [text/csv](https://tools.ietf.org/html/rfc4180)
* [application/json](https://tools.ietf.org/html/rfc4627)
* [application/x-ndjson](http://ndjson.org/)## Usage
Install with npm :
```
npm install --save mime-type-stream
``````
const mimeTypeStream = require('mime-type-stream')
const fs = require('fs')fs.createReadStream('/path/to/file.ndjson')
.pipe(mimeTypeStream('application/x-ndjson').parser())
// Manipulate a stream of JSON objects here
.pipe(mimeTypeStream('text/csv').serializer())
.pipe(fs.createWriteStream('/path/to/file.csv'))
```