tiniest-csv

2.0.0 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i tiniest-csv

Weekly Downloads

0

Version

2.0.0

License

MIT

Last publish

Collaborators

  • gummesson