Socket
Socket
Sign inDemoInstall

@iwsio/json-csv-node

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@iwsio/json-csv-node - npm Package Compare versions

Comparing version 5.0.0-alpha.1 to 5.0.0-alpha.2

6

package.json
{
"name": "@iwsio/json-csv-node",
"version": "5.0.0-alpha.1",
"description": "Export a richly structured, JSON array to CSV",
"version": "5.0.0-alpha.2",
"description": "Easily convert JSON to CSV in Node.JS. This package supports streaming and buffered conversion to CSV.",
"homepage": "https://github.com/IWSLLC/json-csv",

@@ -40,3 +40,3 @@ "author": "Nathan Bridgewater <info@iws.io> (https://iws.io/)",

"dependencies": {
"@iwsio/json-csv-core": "^0.2.4"
"@iwsio/json-csv-core": "^0.2.6"
},

@@ -43,0 +43,0 @@ "scripts": {

@@ -1,12 +0,7 @@

# json-csv, @iwsio/json-csv-node
# @iwsio/json-csv-node
[![Tests CI](https://github.com/IWSLLC/json-csv/actions/workflows/test.yaml/badge.svg)](https://github.com/IWSLLC/json-csv/actions/workflows/test.yaml)
This package extends the simple json-csv-core project specifically targeting Node.JS to support streaming. It's all the same code as before, just moved around.
This package extends [@iwsio/json-csv-core](https://www.npmjs.com/package/@iwsio/json-csv-core) specifically targeting Node.JS to support streaming. It's all the same code as before, just moved around.
## Update `5.0.0`
Here we are again! Recently, an issue was opened regarding browser compatibility. Thinking through this, I decided to break out the core and buffered components into a new package `@iwsio/json-csv-core` that will be browser compatible (Babel transpiled for `default` browserslist). Also, in the spirit of code-reuse, I dumped all of that core code from this package and consumed it from core, so there can still be one central place to fix potential issues.
I'm bumping the major version for this one because of the foundational changes depending on `@iwsio/json-csv-core`. The core package will continue having no other upstream dependencies. This v5.0 is 100% compatible with v4. Please kindly let me know if you run into any issues. All of the original tests are still running across the two packages, and everything seems to be in order among Node 10-16.
# Usage

@@ -28,5 +23,9 @@ ## Buffered (Converts to CSV with an in-memory data source)

const { toCsvStream } = require('@iwsio/json-csv-node')
const things = [{name: 'thing1', age: 20}, {name: 'thing2', age: 30}, {name: 'thing3', age: 45}]
const readable = Readable.from(things) // <readable source in object mode>
readable
const things = [
{name: 'thing1', age: 20},
{name: 'thing2', age: 30},
{name: 'thing3', age: 45}
]
Readable.from(things) // <readable source in object mode>
.pipe(toCsvStream(options)) // transforms to Utf8 string and emits lines

@@ -37,3 +36,19 @@ .pipe(process.stdout) // anything Writable

### NOTE: All the aliases from previous versions remain intact.
I renamed this API mostly for cosmetics and to cleanup named exports for ES Modules. It made more sense to me to `import { toCSV } from 'json-csv'` rather than importing the default and calling its prop. (I've been doing a lot of Typescript lately). But all the original versions are kept intact and tests are in place to assert they work.
```js
const jsonCsv = require('json-csv')
jsonCsv.toCsv // buffered, returns promise, callback optional
jsonCsv.toCsvStream // stream, returns stream, callback optional
jsonCsv.buffered // alias to toCsv (buffered)
jsonCsv.stream // alias to toCsvStream (streamed)
jsonCsv.csv // alias to toCsvStream (streamed)
jsonCsv.csvBuffered // alias to toCsv (buffered)
```
## Options

@@ -40,0 +55,0 @@ ```js

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc