【发布时间】:2019-02-23 07:23:00
【问题描述】:
我需要读取一个 .csv 文件并将 csv 文件转换为 json 格式并将 json 传递给前端
这是读取 csv 文件并转换为 json 的最佳方式
我的代码是:
fs.readFile(req.files.file.path, function(ferr, file) {
if (ferr) {
res.json(HttpStatus.NOT_FOUND, { error: ferr });
}
if (file) { //here i will get my file
//here i need to write code for convert the csv file to json
}
【问题讨论】:
标签: node.js