1.0.0 • Published 7 years ago

@corpsmap/json-to-csv-download v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

JSON to CSV download

This module takes json and creates a CSV file and fires off a download by creating a uri link in the DOM and activating the click callback. There are some limitations due to filesize so if this doesn't work for large datasets you were warned.

Using

var json2csv = require('@corpsmap/json-to-csv-download');

var json = require('some/json/file.json');

json2csv(json, 'CSV_EXPORT', false, false);

Parameters

ParamRequiredDefault ValueDescription
jsontruen/aJSON object to convert to CSV
titlenofalseString title to use for filename and optionally in the CSV
labelColumnsnofalseBoolean, whether or not to add column labels to the first row of the CSV file
addTitleToBodynofalseBoolean, whether or not to add the title to the first row of the CSV file (above label columns if labelColumns is true)