解析csv时出现Paparse错误

时间:2015-07-29 22:30:45

标签: express papaparse

您好我在快递服务器内使用papaparse,我正在尝试解析csv列表,我收到以下错误:

{"data":[],"errors":[],"meta":{"delimiter":",","linebreak":"\n","aborted":false,"truncated":false,"cursor":11,"fields":["my-list.csv"]}}

为什么我会看到这个?

// 1. Declare a GET route
 contactRouter.route('/contacts')
  .get(function(req, res){
    var responseJson = parser;

    res.send(responseJson);
    console.log(responseJson);
 });

// 2. Read the CSV file
var data = "my-list.csv";

var parser = Papa.parse(data, {
header: true,
delimiter: ",",
complete: function(results) {
   console.log(results);
 }
});

1 个答案:

答案 0 :(得分:0)

这不是错误。它是console.log(responseJson);的结果。