parse-csv-simple
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

parse-csv-simple

A parser for csv file.

Usage

Import the library in your code

parse the whole csv string directly

var {parse} = require('parse-csv-simple');
var csvText = 'name,age,gender\nJenny,21,female';
parse(csvText); // [['name', 'age', 'gender'], ['Jenny', '21', 'female']]

get an iterable object, you can control the iterate flow.

var {parseIterable} = require('parse-csv-simple');
var csvText = 'name,age,gender\nJenny,21,female';
var iteratableObj = parseIterable(csvText);

for (var row of iteratableObj) {
  // do something
}

custom the delimiter or rows to parse

var {parse} = require('parse-csv-simple');
var csvText = 'name,age,gender\nJenny,21,female';
var iteratableObj = parse(csvText, { delimiter: '...', limit: 100 });

Readme

Keywords

Package Sidebar

Install

npm i parse-csv-simple

Weekly Downloads

1

Version

1.0.6

License

ISC

Unpacked Size

22.4 kB

Total Files

21

Last publish

Collaborators

  • charlie_wei