After the announcement of the version 0.2.0 of the Node.js CSV parser at the begining of october, we are releasing today a new version 0.2.1. This is mostly a bug fix release with enhanced documentation. However it does introduce a few interesting functionalities as well. The parser documentation has been updated to reflect this new release.
Have from stream send pause/resume advisories from CSV to stream
issue #52 and
Thanks for Dan Kearns for discovering this bug and to Doug Wilson for providing such a great fix. This is an important correction and implies that all the user of the 0.2.0 release to migrate toward this release.
See GitHub issue #30.
This seems like the most requested/interested feature present in this release. The CSV parser may now support two types of callbacks, synchronous and asynchronous. The distinction is made after the callback argument signature. It expects to be called asynchronously if 3 arguments are defined, otherwise it will be run synchronously. The following two examples reverse the columns on each line.
1 2 3 4 5
1 2 3 4 5 6
Line number in parsing error
See GitHub issue #40.
Thanks for E. Timothy Uy for raising the request. The idea is to enhance parsing error message with the line number where the error occur. Additionally, we introduce a new line number property accessible through
Column property to column name
See GitHub issue #53.
This feature was request by Alex Zylman who needed a way to print custom column names in its output file. The retained solution was to allow the
to.options.columns options to be defined as an object. Here’s an example:
1 2 3 4 5 6 7
Skip UTF BOM from first data event on UTF-8 decoded stream
Update and improve samples
Backward compatibility width Node.js < 0.8.x
This is a minor bug introduce after the 0.2 updates and the migration toward Node.js version 0.8. The
path.exists was renamed
fs.exists. The fix was easy by creating the
fs.exists function in case it doesn’t exist. Here’s an extract from the source code:
1 2 3
Other enhancements describe in the change log are:
- Pass options in the
to.stringreceives the number of written records
- Fix from array with the column options
- Travis support
- More doc about columns and transformation