this.papa.parse(this.inputFile, {
header: false,
dynamicTyping: true,
skipEmptyLines: true,
error: (error) => {
console.log('parse_error: ', error);
},
complete: (result) => {
data = result.data;
...
}
});
我解析本地 csv 文件(1.02GB),但无法获取该行的内容。当解析小文件时,一切都是正确的
最佳答案
你应该使用 block 。文档:
Can Papa load and parse huge files? Yes. Parsing huge text files is facilitated by streaming, where the file is loaded a little bit at a time, parsed, and the results are sent to your step callback function, row-by-row. You can also get results chunk-by-chunk (which is usually faster) by using the chunk callback function in the same way. https://www.papaparse.com/docs
至于 papaparse 可以处理的限制大小 - 我不确定。
但我在 2 台机器上进行了测试, block 大小为 45mb(尝试过 20、50、100 等)
- 旧电脑 (amd a8 5600k),配备 8GB 内存 + 8GB 交换内存
- Macbook pro 2015 年中基本型号 - 配备 16GB 内存
尝试解析4gb文件。
chunkSize: 1024 * 1024 * 45
Chrome 和 Opera 的结果
两者在 1.8 - 1.9 GB 时均失败。
FireFox 的结果
两者都成功解析了 4GB 文件。
关于angular - papa 可以解析的文件大小的限制是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65728699/