angular - papa 可以解析的文件大小的限制是多少?

标签 angular papaparse

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/

相关文章:

javascript - PapaParse 生成的数组未填写 ng-repeat

javascript - 如何使用 Papa Parse 从 CSV 文件中将数据提取到 React 状态?

javascript - 如何在 Angular 中制作动态区间

Angular ngFor 使用 map

svg - 如何在 Angular2 中动态创建 SVG 组件?

javascript - 如何重新排列 CSV/JSON 键列? (JavaScript)

javascript - 将 papaparse 的结果移动到数组中

javascript - 如何在表单标签内添加点击事件

java - Spring CORS 和 Angular 不工作 : HTTP status code 403 error

javascript - Angular 算法 : stop ngFileUpload double looping?