3.0.0 • Published 9 years ago

tiny-csv v3.0.0

Weekly downloads
9
License
MIT
Repository
github
Last release
9 years ago

tiny-csv

NPM version License Build status

Parse a CSV string into an array of objects.

Installation

npm install tiny-csv

Usage

var fs  = require('fs')
var csv = require('tiny-csv')

var csvData = fs.readFileSync('data.csv', 'utf8')
console.log(csv(csvData))
// [
//   { key: 'one', value: 'two' },
//   { key: 'three', value: 'four' },
//   { key: 'five', value: 'six' }
// ]

var tsvData = fs.readFileSync('data.tsv', 'utf8')
console.log(csv(tsvData, /\t/))
// [
//   { key: 'one', value: 'two' },
//   { key: 'three', value: 'four' },
//   { key: 'five', value: 'six' }
// ]

Caveats

The module is meant to be used on smaller sets of data. If you need maximum speed, use csv-parser.