write-csv

1.0.0 • Public • Published

write-csv

NPM Version Build Status Coverage Status

Quickest way to write a json array to a .csv file

Install

Install with npm:

npm i --save write-csv

Then require in your file:

var writeCSV = require('write-csv')

Usage

writeFile(filename, data)

  • filename String filename or file descriptor
  • data Array of objects
writeCSV('./results.csv', [
  {a: 'foo', b: 'bar', c: 'baz'},
  {a: 'shoo', b: 'boo', c: 'chaz'},
  {a: 'gaia', b: 'loves', c: 'you'},
])

This will synchronously write your data to results.csv like this:

a,b,c
foo,bar,baz
shoo,boo,chaz
gaia,loves,you

Dependencies (1)

Dev Dependencies (4)

Package Sidebar

Install

npm i write-csv

Weekly Downloads

2,345

Version

1.0.0

License

ISC

Last publish

Collaborators

  • dsernst