1.0.3 • Published 8 years ago
tccsvparser v1.0.3
CSV Parser
Simple csv parser. First line should contain the keys for each object generated, so that:
firstname,lastname
carlos,torija
max,bravo
becomes:
[{
'firstname': 'carlos',
'lastname': 'torija'
},{
'firstname': 'max',
'lastname': 'bravo'
}]
There are two versions, sync and async.
Async
parseCSV (path[, separator], callback)
The callback will receive
(err, json, nomatch)
err
will be returned if the reading of the file fails
json
will contain all the information that was build through the parser
nomatch
will contain any line that has a different length than the title length
Sync
parseCSVSync (path[, separator])
This version will only return all the information that was build through the file