Fast and powerful CSV (delimited text) parser that gracefully handles large files and malformed input
This release adds support for parsing NodeStreams, so papaparse can be used directly on NodeJS.
Thanks to @LeviticusMB for implementing this.
This release is comprised mainly of internal re-factorings, but a few minor behavioral things changed. Most users will not be broken with this release:
"
) are found in the input. Fast mode can be forced on or off by explicitly setting it to true
or false
, respectively.The internal refactoring that took place should help prepare Papa Parse for a possible direct Node.js port in the future. The overall number of lines of code was reduced by about 10%.
Papa Parse 4 sports a new core parser, completely rewritten from scratch, and is now the fastest CSV parser for the browser. Notable features include:
chunk
callbackkeepEmptyRows
is replaced with skipEmptyLines
. New default behavior is to keep empty lines unless you specify otherwise.See the docs and the blog post for more information.
Minor but important fixes for bugs that snuck into 3.1.
Several improvements and bug fixes.
New
step
callback now receives a ParserHandle as an argument:step: function(results, handle) {
// pausing makes the parse function asynchronous if it wasn't already
handle.pause();
// save a reference to it, then resume later:
handle.resume();
// you can also abort entirely:
handle.abort();
}
chunk
config callback. For parsing files only. Instead of being invoked for every row of parsed data, it is only invoked with every chunk of a file that is loaded. It receives by argument the results of the entire chunk.keepEmptyRows
config property. If true, rows that are empty (blank or contain only whitespace) will be preserved.error
config property. For use if FileReader encounters an error while opening a file.truncated
meta property. Results meta now indicates, when using preview, whether the results were truncated. The value will only be true if the preview does not consume the entire input.Papa.DefaultDelimiter
setting. Set to a comma (','
) by default, this value is used if a delimiter is not set and the delimiter cannot be automatically detected.Fixed or changed
null
value is now treated as an empty string rather than throwing an exception.preview
with header
enabled, the preview value specifies how many rows of data, not how many rows total. In other words, 1 is added to the preview value. (For instance, before, preview: 10
with header: true
would parse only 9 rows of data because the first was the header row. Now, 11 total rows are parsed to compensate for the header row.)Plus a few other minor improvements or internal changes.
Lots of improvements and new features.
Added:
Improved/changed: