1 | [![Build Status](https://secure.travis-ci.org/wdavidw/node-csv-parse.png)][travis]
|
2 |
|
3 | Part of the [CSV module][csv_home], this project is a simple object
|
4 | transformation framework. It implements the Node.js [`stream.Transform` API][streamtransform].
|
5 | It also provides a simple callback-based API for convenience.
|
6 | It is both extremely easy to use and powerful.
|
7 |
|
8 | [Documentation for the "csv-parse" package is available here][home].
|
9 |
|
10 | ## Features
|
11 |
|
12 | * Follow the Node.js [streaming API][streamtransform]
|
13 | * Simplicity with the optional callback API
|
14 | * Synchronous and asynchronous user handler functions
|
15 | * Accepts arrays of strings, or arrays of objects as input
|
16 | * Sequential or user-defined concurrent execution
|
17 | * Skip and create new records
|
18 | * Alter or clone input data
|
19 | * BSD License
|
20 |
|
21 | Usage
|
22 | -----
|
23 |
|
24 | Refer to the [project webpage][home] for [an exhaustive list of options][home]
|
25 | and [some usage examples][examples].
|
26 |
|
27 | The module is built on the Node.js Stream API. For the sake of simplify, a
|
28 | simple callback API is also provided. To give you a quick look, here's an
|
29 | example of the callback API:
|
30 |
|
31 | ```javascript
|
32 | var transform = require('stream-transform');
|
33 |
|
34 | input = [ [ '1', '2', '3', '4' ], [ 'a', 'b', 'c', 'd' ] ];
|
35 | transform(input, function(data){
|
36 | data.push(data.shift());
|
37 | return data.join(',')+'\n';
|
38 | }, function(err, output){
|
39 | output.should.eql([ '2,3,4,1\n', 'b,c,d,a\n' ]);
|
40 | });
|
41 | ```
|
42 |
|
43 | Development
|
44 | -----------
|
45 |
|
46 | Tests are executed with mocha. To install it, simple run `npm install`
|
47 | followed by `npm test`. It will install mocha and its dependencies in your
|
48 | project "node_modules" directory and run the test suite. The tests run
|
49 | against the CoffeeScript source files.
|
50 |
|
51 | To generate the JavaScript files, run `npm run coffee`.
|
52 |
|
53 | The test suite is run online with [Travis][travis] against the versions
|
54 | 0.10, 0.11 and 0.12 of Node.js.
|
55 |
|
56 |
|
57 | [streamtransform]: http://nodejs.org/api/stream.html#stream_class_stream_transform
|
58 | [home]: http://csv.adaltas.com/transform/
|
59 | [examples]: http://csv.adaltas.com/transform/examples/
|
60 | [csv_home]: https://github.com/wdavidw/node-csv
|
61 | [stream-samples]: https://github.com/wdavidw/node-stream-transform/tree/master/samples
|
62 | [stream-test]: https://github.com/wdavidw/node-stream-transform/tree/master/test
|
63 | [travis]: http://travis-ci.org/wdavidw/node-stream-transform
|
64 |
|