How to use the papaparse.RemoteChunkSize function in papaparse

To help you get started, we’ve selected a few papaparse examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alephdata / aleph / ui / src / viewers / CsvStreamViewer.jsx View on Github external
fetchRecords() {
    const { document } = this.props;
    const url = document.links.csv;
    if (this.state.rows.length < this.state.requestedRow) {
      if (this.parser !== null) {
        this.parser.resume();
      } else {
        // set chunk size to 100 KB
        Papa.RemoteChunkSize = 1024 * 100;
        Papa.parse(url, {
          download: true,
          delimiter: ',',
          newline: '\n',
          encoding: 'utf-8',
          // header: true,
          chunk: (results, parser) => {
            this.parser = parser;
            this.setState((previousState) => {
              const rows = previousState.rows.concat(results.data);
              const rowIndex = rows.length;
              if (rowIndex > previousState.requestedRow) {
                parser.pause();
              }
              return { rows };
            });
github alephdata / aleph / ui / src / components / EntityMapping / EntityMappingMode.jsx View on Github external
fetchCsvData() {
    const { entity } = this.props;
    const url = entity.links.csv;
    // set chunk size to 100 KB
    Papa.RemoteChunkSize = 1024 * 100;
    Papa.parse(url, {
      download: true,
      delimiter: ',',
      newline: '\n',
      encoding: 'utf-8',
      chunk: (results, parser) => {
        this.setState({
          csvHeader: results.data[0],
          csvData: results.data.slice(1, 15),
        });
        parser.abort();
      },
    });
  }
github alephdata / aleph / ui / src / components / EntityImport / EntityImport.jsx View on Github external
fetchCsvRows() {
    const { entity } = this.props;
    const url = entity.links.csv;
    // set chunk size to 100 KB
    Papa.RemoteChunkSize = 1024 * 100;
    Papa.parse(url, {
      download: true,
      delimiter: ',',
      newline: '\n',
      encoding: 'utf-8',
      chunk: (results, parser) => {
        this.setState({
          csvRows: results.data.slice(0, 10),
        });
        parser.abort();
      },
    });
  }

papaparse

Fast and powerful CSV parser for the browser that supports web workers and streaming large files. Converts CSV to JSON and JSON to CSV.

MIT
Latest version published 2 years ago

Package Health Score

82 / 100
Full package analysis