How to use the @fast-csv/parse.parseString function in @fast-csv/parse

To help you get started, we’ve selected a few @fast-csv/parse examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github C2FO / fast-csv / examples / parsing-js / examples / parse_string.example.js View on Github external
const { EOL } = require('os');
const csv = require('@fast-csv/parse');

const CSV_STRING = ['a,b', 'a1,b1', 'a2,b2'].join(EOL);

csv.parseString(CSV_STRING, { headers: true })
    .on('error', error => console.error(error))
    .on('data', row => console.log(row))
    .on('end', rowCount => console.log(`Parsed ${rowCount} rows`));

// Output:
// { a: 'a1', b: 'b1' }
// { a: 'a2', b: 'b2' }
// Parsed 2 rows

@fast-csv/parse

fast-csv parsing package

MIT
Latest version published 23 days ago

Package Health Score

92 / 100
Full package analysis

Popular @fast-csv/parse functions