0.1.6 • Published 7 years ago

csv-readfile v0.1.6

Weekly downloads
36
License
MIT
Repository
-
Last release
7 years ago

csv-readfile

NPM

Read CSV file as array of rows.

const readFile = require('csv-readfile');
// readFile(<path>, [options])
// -> Promise [<row>]

// options: {
//   columns: true, // use columns: yes, first line
//   comment: '#', // single-line comment: #
//   escape: '"', // escape character: "
//   quote: '"',  // optional character surrounding field: "
//   trim: false,  // remove spaces around unquoted field: no
//   ltrim: false, // remove spaces left of unquoted field: no
//   rtrim: false, // remove spaces right of unquoted field: no
//   skip_empty_lines: false,
//   skip_lines_with_error: false,
//   skip_lines_with_empty_values: false,
//   delimiter: ',',     // end of field: ,
//   rowDelimiter: null, // end of row: \r, \n, or \r\n
//   from: NaN, // read from line: first
//   to: NaN    // read to line: last
// }


// FILE: indianobel.csv
// --------------------
# Indian & Indian-born Nobel laureates
year,field,name
1913,Literature,Rabindranath Tagore
1930,Physics,CV Raman
1968,Physiology or Medicine,Har Gobind Khorana
1979,Peace,Mother Teresa
1983,Physics,Subrahmanyan Chandrasekhar
1998,Economic Sciences,Amartya Sen
2009,Chemistry,Venkatraman Ramakrishnan
2014,Peace,Kailash Satyarthi

// CODE: read csv
// --------------
var data = await readFile('indianobel.csv');
// [ { year: '1913',
//     field: 'Literature',
//     name: 'Rabindranath Tagore' },
//   ...
//   { year: '2014', field: 'Peace', name: 'Kailash Satyarthi' } ]
0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.1

7 years ago