2.0.4 • Published 2 years ago

easy-json2csv v2.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

easy-json2csv

Transform JSON into CSV file or stream

Installing

Install with npm or yarn

  npm install easy-json2csv
    or
  yarn add easy-json2csv

Getting Started

import { CSV }  from "easy-json2csv";

const csv = new CSV();

const header = [
  { columnName: "lines", refersTo: "somePropertyName"}]

const body = [
  { somePropertyName: "line 1" },
  { somePropertyName: "line 2" },
  { somePropertyName: "line 3" },
];

If you want a file

csv 
    .setHeader(header)
    .setBody(body)
    .setEncoding("utf8") //optional
    .write();
    

/* outputs a file containing:

displayName line 1; line 2; line 3; */

If you want a stream

var myCsvStream = csv 
    .setHeader(header)
    .setBody(body)
    .writeAsStream({ encoding: "utf8", hasSpecialChars: true});
2.0.3

2 years ago

2.0.4

2 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.1.9

3 years ago

1.1.8

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago