当前,我正在尝试parse a "local file",
import Papa from 'papaparse';
Papa.parse( '../raw/M49/en.csv', {
header: true,
delimiter: ',',
complete: (res) => console.log("COMPLETE", res),
error: err => console.log("ERROR", err)
} );
当我运行该代码时,这一切我都会回来的,
{ data: [],
errors: [],
meta:
{ delimiter: ',',
linebreak: '\n',
aborted: false,
truncated: false,
cursor: 17,
fields: [ '../raw/M49/en.csv' ] }
答案 0 :(得分:0)
Papa Parse具有三种模式,
Parse Web API File Object
,特定于Web API中的“文件对象”)在浏览器中,这两者都是用File Object表示的“本地文件”。接受路径的选项是Parse a Remote File,这需要设置不直观的选项
download: true
更糟糕的是,运行此命令将返回
ReferenceError: XMLHttpRequest is not defined