Skip to content

Commit

Permalink
Merge pull request #88 from doug-martin/master
Browse files Browse the repository at this point in the history
v 0.5.6
  • Loading branch information
doug-martin committed Feb 22, 2015
2 parents 8ba6b2a + 2f96cd8 commit 1707f04
Show file tree
Hide file tree
Showing 9 changed files with 229 additions and 68 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ language: node_js
node_js:
- "0.10"
- "0.11"
- "0.12"
before_script:
- npm install -g grunt-cli
7 changes: 7 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
53 changes: 31 additions & 22 deletions docs/History.html
Original file line number Diff line number Diff line change
Expand Up @@ -176,33 +176,42 @@



<h1 id="v0-5-5">v0.5.5</h1>
<h1>v0.5.6</h1>
<ul>
<li>Fixed issue where parser_stream was emitting end early <a href="https://github.com/C2FO/fast-csv/issues/87">#87</a><ul>
<li>Changed to not emit end during flush</li>
<li>Changed catch errors on emit and emit as &quot;error&quot; event</li>
</ul>
</li>
<li>Added support for node <code>v0.12</code></li>
</ul>
<h1>v0.5.5</h1>
<ul>
<li>Fixed issues with ordering of headers when specifying headers in a write stream <a href="https://github.com/C2FO/fast-csv/pull/77">#77</a></li>
<li>Fixed issue where headers were not being written if no data was supplied to write stream.</li>
</ul>
<h1 id="v0-5-4">v0.5.4</h1>
<h1>v0.5.4</h1>
<ul>
<li>Fixed issues with error handling and not registering an error handler on stream <a href="https://github.com/C2FO/fast-csv/issues/68">#68</a></li>
<li>Added support for ignoring quoting while parsing <a href="https://github.com/C2FO/fast-csv/issues/75">#75</a></li>
</ul>
<h1 id="v0-5-3">v0.5.3</h1>
<h1>v0.5.3</h1>
<ul>
<li>Fixed issues with <code>v0.11</code> stream implementation <a href="https://github.com/C2FO/fast-csv/issues/73">#73</a></li>
<li>Fixed issues with <code>pause/resume</code> and data events in <code>v0.10</code> <a href="https://github.com/C2FO/fast-csv/issues/69">#69</a></li>
<li>Fixed the double invoking of done callback when parsing files <a href="https://github.com/C2FO/fast-csv/issues/68">#68</a></li>
<li>Refactored tests</li>
</ul>
<h1 id="v0-5-2">v0.5.2</h1>
<h1>v0.5.2</h1>
<ul>
<li>Fixed issue with <code>writeToString</code> and <code>writeToPath</code> examples <a href="https://github.com/C2FO/fast-csv/issues/64">#64</a></li>
<li>Fixed issue with creating a csv without headers <a href="https://github.com/C2FO/fast-csv/issues/63">#63</a></li>
</ul>
<h1 id="v0-5-1">v0.5.1</h1>
<h1>v0.5.1</h1>
<ul>
<li>Fixed issue where line data was not being passed between transforms in the parser_stream</li>
</ul>
<h1 id="v0-5-0">v0.5.0</h1>
<h1>v0.5.0</h1>
<ul>
<li>Added support for async transforms <a href="https://github.com/C2FO/fast-csv/issues/24">#24</a></li>
<li>Added support for async validation</li>
Expand All @@ -219,67 +228,67 @@ <h1 id="v0-5-0">v0.5.0</h1>
<li>More tests</li>
<li>Code refactor and clean up</li>
</ul>
<h1 id="v0-4-4">v0.4.4</h1>
<h1>v0.4.4</h1>
<ul>
<li>Added support for comments. <a href="https://github.com/C2FO/fast-csv/issues/56">#56</a></li>
</ul>
<h1 id="v0-4-3">v0.4.3</h1>
<h1>v0.4.3</h1>
<ul>
<li>Added ability to include a <code>rowDelimiter</code> at the end of a csv with the <code>includeEndRowDelimiter</code> option <a href="https://github.com/C2FO/fast-csv/issues/54">#54</a></li>
<li>Added escaping for values that include a row delimiter</li>
<li>Added more tests for new feature and escaping row delimiter values.</li>
</ul>
<h1 id="v0-4-2">v0.4.2</h1>
<h1>v0.4.2</h1>
<ul>
<li>Added ability to specify a rowDelimiter when creating a csv.</li>
<li>Added discardUnmappedColumns option to allow the ignoring of extra data <a href="https://github.com/C2FO/fast-csv/pull/45">#45</a></li>
</ul>
<h1 id="v0-4-1">v0.4.1</h1>
<h1>v0.4.1</h1>
<ul>
<li>Fixed race condition that occurred if you called pause during a flush.</li>
</ul>
<h1 id="v0-4-0">v0.4.0</h1>
<h1>v0.4.0</h1>
<ul>
<li>Fixed misspelling of <code>delimiter</code> <a href="https://github.com/C2FO/fast-csv/issues/40">#40</a></li>
</ul>
<h1 id="v0-3-1">v0.3.1</h1>
<h1>v0.3.1</h1>
<ul>
<li>Added transform support to formatters<ul>
<li>When using <code>createWriteStream</code> you can now you the <code>transform</code> method to specify a row transformer.</li>
<li>When using other transform methods you can specify a <code>transform</code> option.</li>
</ul>
</li>
</ul>
<h1 id="v0-3-0">v0.3.0</h1>
<h1>v0.3.0</h1>
<ul>
<li>You can now specify <code>objectMode</code> when parsing a csv which will cause <code>data</code> events to have an object emitted.</li>
<li>You can now pipe directly to the stream returned from <code>createWriteStream</code></li>
<li>You can now transform csvs by piping output from parsing into a formatter.</li>
</ul>
<h1 id="v0-2-5">v0.2.5</h1>
<h1>v0.2.5</h1>
<ul>
<li>Fixed issue where not all rows are emitted when using <code>pause</code> and <code>resume</code></li>
</ul>
<h1 id="v0-2-4">v0.2.4</h1>
<h1>v0.2.4</h1>
<ul>
<li>Added more fine grained control to <code>.pause</code> and <code>.resume</code><ul>
<li>You can now pause resume between chunks</li>
</ul>
</li>
</ul>
<h1 id="v0-2-3">v0.2.3</h1>
<h1>v0.2.3</h1>
<ul>
<li>Add new <code>createWriteStream</code> for creating a streaming csv writer</li>
</ul>
<h1 id="v0-2-2">v0.2.2</h1>
<h1>v0.2.2</h1>
<ul>
<li>Fixed issue with having line breaks containing <code>\r\n</code></li>
</ul>
<h1 id="v0-2-1">v0.2.1</h1>
<h1>v0.2.1</h1>
<ul>
<li>Fixed issue with <code>\r</code> line break in parser</li>
</ul>
<h1 id="v0-2-0">v0.2.0</h1>
<h1>v0.2.0</h1>
<ul>
<li>Added multiline value support</li>
<li>Updated escaping logic</li>
Expand All @@ -288,17 +297,17 @@ <h1 id="v0-2-0">v0.2.0</h1>
<li>Removed support for having two quote types instead it just supports a single quote and escape sequence.
Source code (zip)</li>
</ul>
<h1 id="v0-1-2">v0.1.2</h1>
<h1>v0.1.2</h1>
<ul>
<li>Fixed issue with formatter handling undefined or null values.</li>
<li>Changed formatter not not include a new line at the end of a CSV.</li>
<li>Added pause and resume functionality to ParserStream</li>
</ul>
<h1 id="v0-1-1">v0.1.1</h1>
<h1>v0.1.1</h1>
<ul>
<li>Added trim, ltrim, and rtrim to parsing options</li>
</ul>
<h1 id="v0-1-0">v0.1.0</h1>
<h1>v0.1.0</h1>

<hr>

Expand Down
32 changes: 16 additions & 16 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,13 @@


<p><a href="http://travis-ci.org/C2FO/fast-csv"><img src="https://secure.travis-ci.org/C2FO/fast-csv.png" alt="build status"></a></p>
<h1 id="fast-csv">Fast-csv</h1>
<h1>Fast-csv</h1>
<p>This is a library that provides CSV parsing and formatting.</p>
<p><strong>NOTE</strong> As of v0.2.0 <code>fast-csv</code> supports multi-line values.</p>
<h2 id="installation">Installation</h2>
<h2>Installation</h2>
<p><code>npm install fast-csv</code></p>
<h2 id="usage">Usage</h2>
<h3 id="parsing">Parsing</h3>
<h2>Usage</h2>
<h3>Parsing</h3>
<p>All methods accept the following <code>options</code></p>
<ul>
<li><code>objectMode=true</code>: Ensure that <code>data</code> events have an object emitted rather than the stringified version set to false to have a stringified buffer.</li>
Expand Down Expand Up @@ -350,12 +350,12 @@ <h3 id="parsing">Parsing</h3>
.on(&quot;end&quot;, function(){
console.log(&quot;done&quot;);
});</code></pre>
<h3 id="validating">Validating</h3>
<h3>Validating</h3>
<p>You can validate each row in the csv by providing a validate handler. If a row is invalid then a <code>data-invalid</code> event
will be emitted with the row and the index.</p>
<pre class='prettyprint linenums lang-js'><code class="lang-javascript">var stream = fs.createReadStream(&quot;my.csv&quot;);

csv(
csv
.fromStream(stream, {headers : true})
.validate(function(data){
return data.age &lt; 50; //all persons must be under the age of 50
Expand Down Expand Up @@ -389,7 +389,7 @@ <h3 id="validating">Validating</h3>
.on(&quot;end&quot;, function(){
console.log(&quot;done&quot;);
});</code></pre>
<h3 id="transforming">Transforming</h3>
<h3>Transforming</h3>
<p>You can transform data by providing a transform function. What is returned from the transform function will
be provided to validate and emitted as a row.</p>
<pre class='prettyprint linenums lang-js'><code class="lang-javascript">var stream = fs.createReadStream(&quot;my.csv&quot;);
Expand Down Expand Up @@ -419,7 +419,7 @@ <h3 id="transforming">Transforming</h3>
.on(&quot;end&quot;, function(){
console.log(&quot;done&quot;);
});</code></pre>
<h3 id="formatting">Formatting</h3>
<h3>Formatting</h3>
<p><code>fast-csv</code> also allows to you to create create a <code>CSV</code> from data.</p>
<p>Formatting accepts the same options as parsing with an additional <code>transform</code> option.</p>
<ul>
Expand All @@ -439,7 +439,7 @@ <h3 id="formatting">Formatting</h3>
</ul>
</li>
</ul>
<h3 id="data-types">Data Types</h3>
<h3>Data Types</h3>
<p>When creating a CSV <code>fast-csv</code> supports a few data formats.</p>
<p><strong><code>Objects</code></strong></p>
<p>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.</p>
Expand Down Expand Up @@ -479,7 +479,7 @@ <h3 id="data-types">Data Types</h3>
//Generated CSV
//a,a,b,b,c,c
//a1,a2,b1,b2,c1,c2</code></pre>
<h3 id="formatting-functions">Formatting Functions</h3>
<h3>Formatting Functions</h3>
<p><strong><code>createWriteStream(options)</code> or <code>.format(options)</code></strong></p>
<p>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.</p>
<pre class='prettyprint linenums lang-js'><code class="lang-javascript">var csvStream = csv.createWriteStream({headers: true}),
Expand Down Expand Up @@ -739,7 +739,7 @@ <h3 id="formatting-functions">Formatting Functions</h3>
console.log(data); //&quot;A,B\na1,b1\na2,b2\n&quot;
}
);</code></pre>
<h2 id="piping-from-parser-to-writer">Piping from Parser to Writer</h2>
<h2>Piping from Parser to Writer</h2>
<p>You can use <code>fast-csv</code> to pipe the output from a parsed CSV to a transformed CSV by setting the parser to <code>objectMode</code> and using <code>createWriteStream</code>.</p>
<pre class='prettyprint linenums lang-js'><code class="lang-javascript">csv
.fromPath(&quot;in.csv&quot;, {headers: true})
Expand Down Expand Up @@ -774,10 +774,10 @@ <h2 id="piping-from-parser-to-writer">Piping from Parser to Writer</h2>
.fromPath(&quot;in.csv&quot;, {headers: true})
.pipe(formatStream)
.pipe(fs.createWriteStream(&quot;out.csv&quot;, {encoding: &quot;utf8&quot;}));</code></pre>
<h2 id="quoting-columns">Quoting Columns</h2>
<h2>Quoting Columns</h2>
<p>Sometimes you may need to quote columns is certain ways in order meet certain requirements. <code>fast-csv</code> can quote columns and headers almost anyway you may need.</p>
<p><strong>Note</strong> in the following example we use <code>writeToString</code> but the options option are valid for any of the formatting methods.</p>
<h3 id="-quotecolumns-"><code>quoteColumns</code></h3>
<h3><code>quoteColumns</code></h3>
<pre class='prettyprint linenums lang-js'><code>//quote all columns including headers
var objectData = [{a: &quot;a1&quot;, b: &quot;b1&quot;}, {a: &quot;a2&quot;, b: &quot;b2&quot;}],
arrayData = [[&quot;a&quot;, &quot;b&quot;], [&quot;a1&quot;, &quot;b1&quot;], [&quot;a2&quot;, &quot;b2&quot;]];
Expand All @@ -800,7 +800,7 @@ <h3 id="-quotecolumns-"><code>quoteColumns</code></h3>
//a1,&quot;b1&quot;
//a2,&quot;b2&quot;
});</code></pre>
<h3 id="-quoteheaders-"><code>quoteHeaders</code></h3>
<h3><code>quoteHeaders</code></h3>
<pre class='prettyprint linenums lang-js'><code>//quote all columns including headers
var objectData = [{a: &quot;a1&quot;, b: &quot;b1&quot;}, {a: &quot;a2&quot;, b: &quot;b2&quot;}],
arrayData = [[&quot;a&quot;, &quot;b&quot;], [&quot;a1&quot;, &quot;b1&quot;], [&quot;a2&quot;, &quot;b2&quot;]];
Expand Down Expand Up @@ -832,9 +832,9 @@ <h3 id="-quoteheaders-"><code>quoteHeaders</code></h3>
//&quot;a1&quot;,&quot;b1&quot;
//&quot;a2&quot;,&quot;b2&quot;
});</code></pre>
<h2 id="license">License</h2>
<h2>License</h2>
<p>MIT <a href="https://github.com/C2FO/fast-csv/raw/master/LICENSE">https://github.com/C2FO/fast-csv/raw/master/LICENSE</a></p>
<h2 id="meta">Meta</h2>
<h2>Meta</h2>
<ul>
<li>Code: <code>git clone git://github.com/C2FO/fast-csv.git</code></li>
<li>Website: <a href="http://c2fo.com">http://c2fo.com</a></li>
Expand Down
Loading

0 comments on commit 1707f04

Please sign in to comment.