fast-csv
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
@types/node | 12.20.55 | 105.28 kB | MIT | prod | |
lodash.escaperegexp | 4.1.2 | 3.19 kB | MIT | prod | |
lodash.isboolean | 3.0.3 | 2.06 kB | MIT | prod | |
lodash.isequal | 4.5.0 | 12.02 kB | MIT | prod | |
lodash.isfunction | 3.0.9 | 3.06 kB | MIT | prod | |
lodash.isnil | 4.0.0 | 1.77 kB | MIT | prod | |
lodash.isstring | 4.0.1 | 2.13 kB | MIT | prod | |
lodash.isundefined | 3.0.1 | 1.86 kB | MIT | prod |
Fast-CSV is an npm package that serves as a comprehensive CSV parser and writer. This package unifies the functionalities of @fast-csv/format
for formatting CSV files and @fast-csv/parse
designed for parsing CSV files, providing a single package that conveniently manages all things related to CSV files.
To employ Fast-CSV, you need to install the package, typically through npm using the command npm install --save fast-csv
. Once installed, you can use it in your script like:
const csv = require('fast-csv');
This module provides various utilities to parse or format CSV data. For example, to parse CSV data, you could use:
csv.parseString('a,b\na1,b1\na2,b2', {headers: true})
.on('data', row => console.log(row))
.on('end', rowCount => console.log(`Parsed ${rowCount} rows`));
You can use similar code to write data to a CSV file.
const dataRows = [
{a: 'a1', b: 'b1'},
{a: 'a2', b: 'b2'},
];
csv.writeToString(dataRows, {headers: true})
.then(csvString => console.log(csvString))
The official Fast-CSV documentation is hosted on C2FO's official website. You can access them using these links: