Exciting release!Introducing "safe npm". Learn more
Socket
Log inDemoInstall

csv2

Package Overview
Dependencies
1
Maintainers
1
Versions
7
Issues
File Explorer

Advanced tools

csv2

A Node Streams2 CSV parser

    0.1.1latest
    GitHub

Version published
Maintainers
1
Weekly downloads
998
increased by1.73%

Weekly downloads

Readme

Source

csv2

Build Status

NPM

A Node Streams2 CSV parser

Will parse an input character stream and pass on an array for each line of CSV data.

csv2 can handle basic CSV quoting and escaping: foo,"bar","wut? ""whoa!""","commas, in, my, strings??"

The only main "feature" not currently supported is newlines within quoted strings; newlines are treated strictly as row separators.

fs.createReadStream('data.csv') .pipe(csv2()) .on('data', console.log)

Or, use through2 to transform your CSV into JSON:

fs.createReadStream('data.csv') .pipe(csv2()) .pipe(through2({ objectMode: true }, function (chunk, enc, callback) { this.push({ name : chunk[0] , address : chunk[3] , phone : chunk[10] }) callback() })) .on('data', console.log)

API

csv2([ options ])

The optional options object is passed through to the stream.Through class. You can supply a 'separator' option to change the default separator from ',' to whatever your data is using.

License

csv2 is Copyright (c) 2013 Rod Vagg @rvagg and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.

Keywords

FAQs

Last updated on 10 May 2014

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
support@socket.devSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc