UNPKG

2.31 kBMarkdownView Raw
1[![Build Status](https://secure.travis-ci.org/wdavidw/node-csv-parse.png)][travis]
2
3Part of the [CSV module][csv_home], this project is a simple object
4transformation framework. It implements the Node.js [`stream.Transform` API][streamtransform].
5It also provides a simple callback-based API for convenience.
6It 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
21Usage
22-----
23
24Refer to the [project webpage][home] for [an exhaustive list of options][home]
25and [some usage examples][examples].
26
27The module is built on the Node.js Stream API. For the sake of simplify, a
28simple callback API is also provided. To give you a quick look, here's an
29example of the callback API:
30
31```javascript
32var transform = require('stream-transform');
33
34input = [ [ '1', '2', '3', '4' ], [ 'a', 'b', 'c', 'd' ] ];
35transform(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
43Development
44-----------
45
46Tests are executed with mocha. To install it, simple run `npm install`
47followed by `npm test`. It will install mocha and its dependencies in your
48project "node_modules" directory and run the test suite. The tests run
49against the CoffeeScript source files.
50
51To generate the JavaScript files, run `npm run coffee`.
52
53The test suite is run online with [Travis][travis] against the versions
540.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