3

I'm just getting started with PapaParse, so sorry if this is a silly question.

If I parse a file, I get my nice results object, I can look at the headers, and all that:

Papa.parse(file, {
header: true,
dynamicTyping: true,    
complete: function(results) {
console.log("done");
data = results;
//headers = split(data[0]);
headers = results.meta['fields'];

However, if I add in a step callback, the results object in complete step is not defined. What am I actually supposed to do in the step callback? Their examples just dump the output of each row to the console.

Papa.parse(file, {
header: true,
dynamicTyping: true,
step: function(row) {
//console.log(row.data);
data.push(row.data);
},
complete: function(results) {
console.log("done");
data = results;
//headers = split(data[0]);
headers = results.meta['fields'];
Andrew
  • 8,445
  • 3
  • 28
  • 46

1 Answers1

3

In papa parse, usually step i.e, streaming is normally used when you process a large file. So you will process the data as parser is reading them. And when streaming, parse results are not available in the complete callback.

To know more about streaming in papa parse check out this. Also, see more about the step function and complete callback in the config explanation section of the documentation.

Hope this Helps

arifin4web
  • 696
  • 8
  • 12