1

Here's my code:

var options = {

    rowDelimiter: 'windows',
    encoding: 'ascii'

}

var data = fs.readFileSync(localFolder+'/'+file, 'ascii');                  

console.log(data);

csv().from.string(data, options).to.array(function(data, count) {

    console.log(data);

});

The first console.log returns the following data:

"Filename","DID#","Document Type","Date Sent","School","First Name","Middle Name","Last Name","DOB","SSN","Application #","Common App ID","RH CEEB","Class Of","Years Attended" "TR58A3D.pdf","TR58A3D","Transcript","07/19/2012","zz Screaming Eagle High School","Kim","","Smith","05/05/1995","","","","555555","2013","" "TR58AQH.pdf","TR58AQH","Transcript","07/19/2012","zz Screaming Eagle High School","Jon","","Sink","05/09/1996","","","","555555","2015",""

[scott@localhost]$ file transcripts/index_07_19_2012_1043460.csv transcripts/index_07_19_2012_1043460.csv: ASCII text, with CRLF line terminators

The second console.log doesn't print anything to my console. Anyone have any ideas why it's not parsing the CSV?

2
  • .from.path expects a file path, not a string of data, but I don't know how to pass options using just .from(data). Commented Jul 1, 2013 at 20:47
  • Sorry, I tried from.string(), and that doesn't appear to be working either. Commented Jul 1, 2013 at 22:21

1 Answer 1

1

The problem was the value for rowDelimiter option. It needs to be the actual line break character used - i.e.: \r\n or \r.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.