tiny-csv

3.0.0 • Public • Published

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.

Readme

Keywords

Package Sidebar

Install

npm i tiny-csv

Weekly Downloads

8

Version

3.0.0

License

MIT

Last publish

Collaborators

  • gummesson