Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/janl/node-csv-parser
Full featured CSV parser with simple api and tested against large datasets.
https://github.com/janl/node-csv-parser
Last synced: 3 months ago
JSON representation
Full featured CSV parser with simple api and tested against large datasets.
- Host: GitHub
- URL: https://github.com/janl/node-csv-parser
- Owner: janl
- License: other
- Fork: true (adaltas/node-csv)
- Created: 2012-11-29T10:29:12.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2012-11-19T15:13:01.000Z (about 12 years ago)
- Last Synced: 2024-04-07T01:27:46.268Z (9 months ago)
- Language: CoffeeScript
- Homepage: http://www.adaltas.com/projects/node-csv
- Size: 545 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://secure.travis-ci.org/wdavidw/node-csv-parser.png)](http://travis-ci.org/wdavidw/node-csv-parser)
_ _ _ _____ _______ __
| \ | | | | / ____|/ ____\ \ / /
| \| | ___ __| | ___ | | | (___ \ \ / /
| . ` |/ _ \ / _` |/ _ \| | \___ \ \ \/ /
| |\ | (_) | (_| | __/| |____ ____) | \ /
|_| \_|\___/ \__,_|\___| \_____|_____/ \/ New BSD License[Documentation for the CSV parser is available here](http://www.adaltas.com/projects/node-csv/).
Important
---------This readme cover the current version 0.2.x of the node
csv parser.The documentation for the current version 0.1.0 is
available [here](https://github.com/wdavidw/node-csv-parser/tree/v0.1).Install command is `npm install csv`.
Quick example
-------------```javascript
// node samples/string.js
var csv = require('csv');
csv()
.from( '"1","2","3","4"\n"a","b","c","d"' )
.to( console.log )
// Output:
// 1,2,3,4
// a,b,c,d
```Advanced example
----------------
```javascript
// node samples/sample.js
var csv = require('csv');
csv()
.from.stream(fs.createReadStream(__dirname+'/sample.in'))
.to.path(__dirname+'/sample.out')
.transform( function(data){
data.unshift(data.pop());
return data;
})
.on('record', function(data,index){
console.log('#'+index+' '+JSON.stringify(data));
})
.on('end', function(count){
console.log('Number of lines: '+count);
})
.on('error', function(error){
console.log(error.message);
});
// Output:
// #0 ["2000-01-01","20322051544","1979.0","8.8017226E7","ABC","45"]
// #1 ["2050-11-27","28392898392","1974.0","8.8392926E7","DEF","23"]
// Number of lines: 2
```Migration
---------The functions 'from*' and 'to*' are now rewritten as 'from.*' and 'to.*'. The 'data'
event is now the 'record' event. The 'data' now recieved a stringified version of
the 'record' event.Development
-----------Tests are executed with mocha. To install it, simple run `npm install`, it will install
mocha and its dependencies in your project "node_modules" directory.To run the tests:
```bash
npm test
```The tests run against the CoffeeScript source files.
To generate the JavaScript files:
```bash
make build
```The test suite is run online with [Travis][travis] against Node.js version 0.6, 0.7, 0.8 and 0.9.
Contributors
------------* David Worms:
* Will White:
* Justin Latimer:
* jonseymour:
* pascalopitz:
* Josh Pschorr:
* Elad Ben-Israel:
* Philippe Plantier:
* Tim Oxley:
* Damon Oehlman:
* Alexandru Topliceanu:
* Visup:
* Edmund von der Burg:
* Douglas Christopher Wilson:Related projects
----------------* Pavel Kolesnikov "ya-csv":
* Chris Williams "node-csv":[travis]: https://travis-ci.org/#!/wdavidw/node-csv-parser