Hi Friends , I stuck with reading a csv file using the fast -csv option .
I need to validate the header names of csv file before uploading but I am not getting a way to do it ..
Could you guys help me out .
csv
.fromStream(file, {headers :true})
.on("error", function(data){
sendWrongHeadersResponse(res);
})
.on("data", function(data){
uploadtoDB(data);
});
function sendWrongHeadersResponse(){
res.send("invalid headers found");
}
My CSV file should have header1, header2 , header3 and header4 and no other fileds