Socket
Socket
Sign inDemoInstall

json-to-csv-stream

Package Overview
Dependencies
29
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.1.0

14

index.js

@@ -10,11 +10,17 @@ 'use strict'

function JSONToCsv () {
return pumpify(JSONStream.parse(), split(), CsvStream())
function JSONToCsv (options) {
options = options || {}
return pumpify(
JSONStream.parse(options.path),
split(),
CsvStream(options.csv)
)
}
function split () {
return through.obj(function (array, enc, callback) {
array.forEach(this.push.bind(this))
return through.obj(function (chunk, enc, callback) {
if (Array.isArray(chunk)) chunk.forEach(this.push.bind(this))
else this.push(chunk)
callback(null)
})
}
{
"name": "json-to-csv-stream",
"main": "index.js",
"version": "1.0.0",
"version": "1.1.0",
"description": "Convert a JSON array stream into CSV rows",

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -24,4 +24,27 @@ # json-to-csv-stream [![Build Status](https://travis-ci.org/bendrucker/json-to-csv-stream.svg?branch=master)](https://travis-ci.org/bendrucker/json-to-csv-stream)

## API
#### `jsonToCsvStream(options)` -> `Transform`
##### options
Type: `object`
Default: `{}`
###### path
Type: `any`
Default: `undefined`
A path for [`JSONStream.parse`](https://github.com/dominictarr/JSONStream#jsonstreamparsepath).
###### csv
Type: `object`
Default: `undefined`
Options to pass to [`csv-write-stream`](https://github.com/maxogden/csv-write-stream#var-writer--csvwriteroptions).
## License
MIT © [Ben Drucker](http://bendrucker.me)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc