mholt / PapaParse

Fast and powerful CSV (delimited text) parser that gracefully handles large files and malformed input
http://PapaParse.com
MIT License
12.54k stars 1.15k forks source link

meta.cursor value is incorrect if you use parser.pause() and parser.resume() in step function #768

Closed Bunlong closed 4 years ago

Bunlong commented 4 years ago

I am using PapaParse the latest version 5.1.1.

I'm trying to make use of meta.cursor to display a progress bar as well. The following example works fine:

Papa.parse(file, {
    step: function(results, parser){
        // This gives expected result for cursor
        console.info(result.meta.cursor);
     }
}

But when I make use of parser.pause() and parser.resume() the value for meta.cursor is incorrect.

Papa.parse(file, {
    step: function(results, parser){
        // This does not give the correct value for cursor
        console.info(result.meta.cursor);
        parser.pause();
        parser.resume();
    }
}

Could you please kindly check? Thanks!

pokoli commented 4 years ago

I'm closing this as duplicate of #321