read-csv-json
v1.1.0
Published
It is a module of reading a CSV file and resolve JSON data type as a promise.
Downloads
5
Maintainers
Readme
read-csv-json
It is a module of reading CSV file and resolve JSON data as a promise.
Install
$ npm install --save read-csv-json
Usage
var csvModule = require("read-csv-json")
Usage
## Usage
var _filePath = './input.csv';
var fieldsName = ['name', 'age', 'number'];
var csvRead = new csvModule(_filePath, fieldsName);
csvRead.getCSVJson().then(function(result){
console.log('result: ', JSON.stringify(result));
},function(err){
console.log('err: ', err)
});
// result of console.log
// [{
// name: 'name1',
// age: 'age1',
// number: 'number1'
// }, {
// name: 'name2',
// age: 'age2',
// number: 'number2'
// }]