csv-simple-writer
v1.0.0
Published
lightweight csv writer
Downloads
5
Maintainers
Readme
csv-simple-writer
Install
npm install csv-simple-writer
Usage
const CSV = require("csv-simple-writer");
/**
* @method .write(path, data, options)
* @param {string} path Absolute path to file
* @param {Object[]} data Array of objects to write
* @param {Object} [options={separator:';", encoding: 'utf-8'}] Flags parameters
*
* @returns {Promise}
*/
await CSV.write("/home/nemo/documents/find.csv", [
{ index: "Index", name: "Name", email: "Email" },
{ index: 0, name: "Marlin", email: "[email protected]" },
{ index: 1, name: "Dory", email: "[email protected]" },
{ index: 2, name: "Bruce", email: "[email protected]" },
{ index: 3, name: "Coral", email: "[email protected]" },
]);
CSV output find.csv
:
|Index|Name|Email|
|-|-|-|
|0|Marlin|[email protected]|
|1|Dory|[email protected]|
|2|Bruce|[email protected]|
|3|Coral|[email protected]|
Note
- not sorted or grouping by fields. write as is