From 2f96cd81228e0f854e3d3514ff48e4e35da09498 Mon Sep 17 00:00:00 2001 From: Doug Martin Date: Sun, 22 Feb 2015 15:55:56 -0600 Subject: [PATCH] * Fixed issue where parser_stream was emitting end early #87 * Changed to not emit end during flush * Changed catch errors on emit and emit as "error" event * Added support for node `v0.12` --- .travis.yml | 1 + History.md | 7 +++ docs/History.html | 53 +++++++++++-------- docs/index.html | 32 ++++++------ lib/parser/parser_stream.js | 52 ++++++++++--------- package.json | 2 +- test/assets/issue87.csv | 100 ++++++++++++++++++++++++++++++++++++ test/issues.test.js | 45 +++++++++++++++- test/parsing.test.js | 5 +- 9 files changed, 229 insertions(+), 68 deletions(-) create mode 100644 test/assets/issue87.csv diff --git a/.travis.yml b/.travis.yml index 34131357..491ba94a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,5 +2,6 @@ language: node_js node_js: - "0.10" - "0.11" + - "0.12" before_script: - npm install -g grunt-cli \ No newline at end of file diff --git a/History.md b/History.md index a8981fce..cdcc6eb6 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,10 @@ +# v0.5.6 + +* Fixed issue where parser_stream was emitting end early [#87](https://github.com/C2FO/fast-csv/issues/87) + * Changed to not emit end during flush + * Changed catch errors on emit and emit as "error" event +* Added support for node `v0.12` + # v0.5.5 * Fixed issues with ordering of headers when specifying headers in a write stream [#77](https://github.com/C2FO/fast-csv/pull/77) * Fixed issue where headers were not being written if no data was supplied to write stream. diff --git a/docs/History.html b/docs/History.html index e573794e..b300e3e8 100644 --- a/docs/History.html +++ b/docs/History.html @@ -176,33 +176,42 @@ -

v0.5.5

+

v0.5.6

+ +

v0.5.5

-

v0.5.4

+

v0.5.4

-

v0.5.3

+

v0.5.3

-

v0.5.2

+

v0.5.2

-

v0.5.1

+

v0.5.1

-

v0.5.0

+

v0.5.0

-

v0.4.4

+

v0.4.4

-

v0.4.3

+

v0.4.3

-

v0.4.2

+

v0.4.2

-

v0.4.1

+

v0.4.1

-

v0.4.0

+

v0.4.0

-

v0.3.1

+

v0.3.1

-

v0.3.0

+

v0.3.0

-

v0.2.5

+

v0.2.5

-

v0.2.4

+

v0.2.4

-

v0.2.3

+

v0.2.3

-

v0.2.2

+

v0.2.2

-

v0.2.1

+

v0.2.1

-

v0.2.0

+

v0.2.0

-

v0.1.2

+

v0.1.2

-

v0.1.1

+

v0.1.1

-

v0.1.0

+

v0.1.0


diff --git a/docs/index.html b/docs/index.html index 05b32d3e..03cc9ee6 100644 --- a/docs/index.html +++ b/docs/index.html @@ -178,13 +178,13 @@

build status

-

Fast-csv

+

Fast-csv

This is a library that provides CSV parsing and formatting.

NOTE As of v0.2.0 fast-csv supports multi-line values.

-

Installation

+

Installation

npm install fast-csv

-

Usage

-

Parsing

+

Usage

+

Parsing

All methods accept the following options

-

Data Types

+

Data Types

When creating a CSV fast-csv supports a few data formats.

Objects

You can pass in object to any formatter function if your csv requires headers the keys of the first object will be used as the header names.

@@ -479,7 +479,7 @@

Data Types

//Generated CSV //a,a,b,b,c,c //a1,a2,b1,b2,c1,c2 -

Formatting Functions

+

Formatting Functions

createWriteStream(options) or .format(options)

This is the lowest level of the write methods, it creates a stream that can be used to create a csv of unknown size and pipe to an output csv.

var csvStream = csv.createWriteStream({headers: true}),
@@ -739,7 +739,7 @@ 

Formatting Functions

console.log(data); //"A,B\na1,b1\na2,b2\n" } );
-

Piping from Parser to Writer

+

Piping from Parser to Writer

You can use fast-csv to pipe the output from a parsed CSV to a transformed CSV by setting the parser to objectMode and using createWriteStream.

csv
    .fromPath("in.csv", {headers: true})
@@ -774,10 +774,10 @@ 

Piping from Parser to Writer

.fromPath("in.csv", {headers: true}) .pipe(formatStream) .pipe(fs.createWriteStream("out.csv", {encoding: "utf8"}));
-

Quoting Columns

+

Quoting Columns

Sometimes you may need to quote columns is certain ways in order meet certain requirements. fast-csv can quote columns and headers almost anyway you may need.

Note in the following example we use writeToString but the options option are valid for any of the formatting methods.

-

quoteColumns

+

quoteColumns

//quote all columns including headers
 var objectData = [{a: "a1", b: "b1"}, {a: "a2", b: "b2"}],
     arrayData = [["a", "b"], ["a1", "b1"], ["a2", "b2"]];
@@ -800,7 +800,7 @@ 

quoteColumns

//a1,"b1" //a2,"b2" });
-

quoteHeaders

+

quoteHeaders

//quote all columns including headers
 var objectData = [{a: "a1", b: "b1"}, {a: "a2", b: "b2"}],
     arrayData = [["a", "b"], ["a1", "b1"], ["a2", "b2"]];
@@ -832,9 +832,9 @@ 

quoteHeaders

//"a1","b1" //"a2","b2" });
-

License

+

License

MIT https://github.com/C2FO/fast-csv/raw/master/LICENSE

-

Meta

+

Meta