mholt/PapaParse

row.meta.cursor in step always same value when parsing in worker mode

オープン

#465 opened on 2018/03/16

 (8 件のコメント) (2 件のリアクション) (0 人の担当者)JavaScript (1,185 件のフォーク)batch import
enhancementhelp wanted

Repository metrics

Stars
 (13,548 個のスター)
PR merge metrics
 (平均マージ 18h) (30d で 1 merged PR)

説明

Not sure if this is a bug or simply a limitation of parsing in worker mode, but when I parse a (local) file in worker mode, the row.meta.cursor always points to the end of the file:

Papa.parse(file, {
  header: true,
  worker: true, // << worker is true
  step: (row, parser) => {
    console.log(row.meta.cursor, file.size);
    // => logs "677403 677403" 8973 times
  },
});
Papa.parse(file, {
  header: true,
  worker: false, // << worker is false
  step: (row, parser) => {
    console.log(row.meta.cursor, file.size);
    // => logs increasisng number upto filesize as expected
  },
});

Is there any way to get the cursor (or anything else that can be used as a progress-indicator) when parsing in worker mode?

コントリビューターガイド