diff --git a/History.md b/History.md index 6f2c4272..70be6900 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,10 @@ +# v1.1.0 + +* Fix for when chunk returned by transform to the parser ends with a space +* Functionality to give a reason when invalid data +* Fix problem with utf8 encoded streams that have multi-byte characters +* Allow passing sparse array of headers + # v1.0.0 * Node 4 and 5 support. diff --git a/docs/History.html b/docs/History.html index 8b2f2b1f..f261ae22 100644 --- a/docs/History.html +++ b/docs/History.html @@ -176,6 +176,18 @@ +
record
event.All methods accept the following options
objectMode=true
: Ensure that data
events have an object emitted rather than the stringified version set to false to have a stringified buffer.headers=false
: Set to true if you expect the first line of your CSV
to contain headers, alternatly you can specify an array of headers to use.headers=false
: Set to true if you expect the first line of your CSV
to contain headers, alternatly you can specify an array of headers to use. You can also specify a sparse array to omit some of the columns.ignoreEmpty=false
: If you wish to ignore empty rows.discardUnmappedColumns=false
: If you want to discard columns that do not map to a header.strictColumnHandling=false
: If you want to consider empty lines/lines with too few fields as errors - Only to be used with headers=true
To omit some of the data columns you may not need, pass a sparse array as headers
.
var stream = fs.createReadStream("my.csv");
+
+csv
+ .fromStream(stream, {headers : ["firstName" , , "address"]})
+ .on("data", function(data){
+ console.log(data);
+ })
+ .on("end", function(){
+ console.log("done");
+ });
If your data may include empty rows, the sort Excel might include at the end of the file for instance, you can ignore
these by including the ignoreEmpty
option.
Any rows consisting of nothing but empty strings and/or commas will be skipped, without emitting a 'data' or 'error' event.
diff --git a/package.json b/package.json index a9fbe502..3cb79284 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fast-csv", - "version": "1.0.0", + "version": "1.1.0", "description": "CSV parser and writer", "main": "index.js", "scripts": {