Created
August 13, 2014 03:28
-
-
Save adamanthil/f31eb8314ce2d05a131a to your computer and use it in GitHub Desktop.
The following javascript should stop triggering events before running through the entire sample csv file using the csvtojson module. See issue: https://github.com/Keyang/node-csvtojson/issues/28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var importIndex = 0; | |
var csvConverter = new Converter({ constructResult:false }); | |
var fileStream = fs.createReadStream('large-csv-sample.csv'); | |
csvConverter.on('record_parsed',function(rowObj, rowArray, rowIndex){ | |
var rowId = rowArray[0]; | |
var fileNum = rowArray[1]; | |
importIndex++; | |
console.log(rowId, importIndex); | |
}); | |
fileStream.pipe(csvConverter); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment