tiniest-csv
v2.0.0
Published
Parse a CSV string into a two-dimensional array.
Downloads
1
Readme
tiniest-csv
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.