PapaParse
PapaParse copied to clipboard
preview + step never completes
The discussion (in #352) and the docs indicate that the meta.truncated value should become true when the last row to preview is parsed. But it doesn't it remains false and complete is never called. This means short of keeping your own counter there is no way to know that preview has completed.
To repro:
- Go to the demo.
- Select local file.
- check Stream option.
- Set preview to any positive non-zero value
- Click parse
- Nothing ever shows up in the console
I am having the same issue. I think that the current behavior where complete() is not called if preview is specified is not very intuitive.
At a minimum, there should be some way to detect that parsing is "done", maybe fire some other new event to indicate that truncated parsing is done, or at least ensure meta.truncated=true so that as an implementer we don't have to manually keep track of the rows processed to know when preview is finished.
Here is my configuration:
parse(fs.createReadStream(filename, 'utf-8'), {
preview: 1,
header: true,
skipEmptyLines: true,
step: row => {
this.log.debug('CSV parsed row');
// row.meta.truncate is always false
},
error: error => {
this.log.debug('Errors parsing file', error);
},
complete: () => {
// never called
});
Still facing the same issue
still facing this issue. can a previewComplete callback be added?