Skip to content

Instantly share code, notes, and snippets.

@lukegalea
Created May 19, 2011 13:20
Show Gist options
  • Save lukegalea/980736 to your computer and use it in GitHub Desktop.
Save lukegalea/980736 to your computer and use it in GitHub Desktop.
node-csv-parser error
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Object function (){
var state = {
count: 0,
countWriten: 0,
field: '',
line: [],
lastC: '',
quoted: false,
commented: false,
buffer: null,
bufferPosition: 0
}
// Defined Class
var CSV = function(){
// Set options
this.readOptions = {
delimiter: ',',
quote: '"',
escape: '"',
columns: null,
flags: 'r',
encoding: 'utf8',
bufferSize: 8 * 1024 * 1024,
trim: false,
ltrim: false,
rtrim: false
};
this.writeOptions = {
delimiter: null,
quote: null,
escape: null,
lineBreaks: null,
flags: 'w',
encoding: 'utf8',
bufferSize: null,
end: true
};
}
CSV.prototype.__proto__ = EventEmitter.prototype;
// Reading API
CSV.prototype.from = function(data,options){
if(options) merge(this.readOptions,options);
var self = this;
process.nextTick(function(){
if(data instanceof Array){
if( csv.writeOptions.lineBreaks === null ){
csv.writeOptions.lineBreaks = "\r\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment