@@ -185,6 +185,12 @@ <h3>Parsing</h3>
185
185
< li > < strong > NOTE</ strong > When specifying an alternate < code > delimiter</ code > you may only pass in a single character delimeter</ li >
186
186
</ ul >
187
187
</ li >
188
+ < li > The following are options for parsing only.< ul >
189
+ < li > < code > trim=false</ code > : If you want to trim all values parsed set to true.</ li >
190
+ < li > < code > rtrim=false</ code > : If you want to right trim all values parsed set to true.</ li >
191
+ < li > < code > ltrim=false</ code > : If you want to left trim all values parsed set to true.</ li >
192
+ </ ul >
193
+ </ li >
188
194
</ ul >
189
195
< p > < strong > events</ strong > </ p >
190
196
< p > < code > parse-error</ code > : Emitted if there was an error parsing a row.
@@ -332,61 +338,61 @@ <h3>Formatting</h3>
332
338
< p > Create a readable stream to read data from.</ p >
333
339
< pre class ='prettyprint linenums lang-js '> < code class ="lang-javascript "> var ws = fs.createWritableStream("my.csv");
334
340
csv
335
- .write([
336
- ["a", "b"],
337
- ["a1", "b1"],
338
- ["a2", "b2"]
339
- ], {headers: true})
340
- .pipe(ws);</ code > </ pre >
341
+ .write([
342
+ ["a", "b"],
343
+ ["a1", "b1"],
344
+ ["a2", "b2"]
345
+ ], {headers: true})
346
+ .pipe(ws);</ code > </ pre >
341
347
< pre class ='prettyprint linenums lang-js '> < code class ="lang-javascript "> var ws = fs.createWritableStream("my.csv");
342
348
csv
343
- .write([
344
- {a: "a1", b: "b1"},
345
- {a: "a2", b: "b2"}
346
- ], {headers: true})
347
- .pipe(ws);</ code > </ pre >
349
+ .write([
350
+ {a: "a1", b: "b1"},
351
+ {a: "a2", b: "b2"}
352
+ ], {headers: true})
353
+ .pipe(ws);</ code > </ pre >
348
354
< p > < strong > < code > writeToStream(stream,arr[, options])</ code > </ strong > </ p >
349
355
< p > Write an array of values to a < code > WritableStream</ code > </ p >
350
356
< pre class ='prettyprint linenums lang-js '> < code class ="lang-javascript "> csv
351
- .writeToStream(fs.createWritableStream("my.csv"), [
352
- ["a", "b"],
353
- ["a1", "b1"],
354
- ["a2", "b2"]
355
- ], {headers: true});</ code > </ pre >
357
+ .writeToStream(fs.createWritableStream("my.csv"), [
358
+ ["a", "b"],
359
+ ["a1", "b1"],
360
+ ["a2", "b2"]
361
+ ], {headers: true});</ code > </ pre >
356
362
< pre class ='prettyprint linenums lang-js '> < code class ="lang-javascript "> csv
357
- .writeToStream(fs.createWritableStream("my.csv"), [
358
- {a: "a1", b: "b1"},
359
- {a: "a2", b: "b2"}
360
- ], {headers: true})
361
- .pipe(ws);</ code > </ pre >
363
+ .writeToStream(fs.createWritableStream("my.csv"), [
364
+ {a: "a1", b: "b1"},
365
+ {a: "a2", b: "b2"}
366
+ ], {headers: true})
367
+ .pipe(ws);</ code > </ pre >
362
368
< p > < strong > < code > writeToPath(arr[, options])</ code > </ strong > </ p >
363
369
< p > Write an array of values to the specified path</ p >
364
370
< pre class ='prettyprint linenums lang-js '> < code class ="lang-javascript "> csv
365
- .writeToPath("my.csv", [
366
- ["a", "b"],
367
- ["a1", "b1"],
368
- ["a2", "b2"]
369
- ], {headers: true})
370
- .on("finish", function(){
371
- console.log("done!");
372
- });</ code > </ pre >
371
+ .writeToPath("my.csv", [
372
+ ["a", "b"],
373
+ ["a1", "b1"],
374
+ ["a2", "b2"]
375
+ ], {headers: true})
376
+ .on("finish", function(){
377
+ console.log("done!");
378
+ });</ code > </ pre >
373
379
< pre class ='prettyprint linenums lang-js '> < code class ="lang-javascript "> csv
374
- .writeToStream("my.csv", [
375
- {a: "a1", b: "b1"},
376
- {a: "a2", b: "b2"}
377
- ], {headers: true})
378
- .on("finish", function(){
379
- console.log("done!");
380
- });</ code > </ pre >
380
+ .writeToStream("my.csv", [
381
+ {a: "a1", b: "b1"},
382
+ {a: "a2", b: "b2"}
383
+ ], {headers: true})
384
+ .on("finish", function(){
385
+ console.log("done!");
386
+ });</ code > </ pre >
381
387
< p > < strong > < code > writeToString(arr[, options])</ code > </ strong > </ p >
382
388
< pre class ='prettyprint linenums lang-js '> < code class ="lang-javascript "> csv.writeToString([
383
- ["a", "b"],
384
- ["a1", "b1"],
385
- ["a2", "b2"]
389
+ ["a", "b"],
390
+ ["a1", "b1"],
391
+ ["a2", "b2"]
386
392
], {headers: true}); //"a,b\na1,b1\na2,b2\n"</ code > </ pre >
387
393
< pre class ='prettyprint linenums lang-js '> < code class ="lang-javascript "> csv.writeToString([
388
- {a: "a1", b: "b1"},
389
- {a: "a2", b: "b2"}
394
+ {a: "a1", b: "b1"},
395
+ {a: "a2", b: "b2"}
390
396
], {headers: true}); //"a,b\na1,b1\na2,b2\n"</ code > </ pre >
391
397
< h2 > Benchmarks</ h2 >
392
398
< p > < code > Parsing 20000 records AVG over 3 runs</ code > </ p >
0 commit comments