2.0.0 • Published 9 years ago

tiniest-csv v2.0.0

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

tiniest-csv

NPM version License Build status

Parse a CSV string into a two-dimensional array.

Installation

npm install tiniest-csv

Usage

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

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

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

Caveats

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

License

MIT