csv-parser is a high-performance streaming CSV parser for Node.js, currently at version 3.2.0. It efficiently converts CSV data into JSON objects using a Node.js readable stream interface, designed for maximum speed and rigorous compatibility with the `csv-spectrum` test suite. The library is capable of processing approximately 90,000 rows per second, with performance varying based on data characteristics. It includes TypeScript type definitions, enabling robust development in typed environments, and is compatible with browserify for client-side applications. While direct stream piping is common, a Promise-based wrapper is available via `neat-csv`. The project maintains an active release cadence, focusing on bug fixes, performance, and compatibility with modern Node.js runtimes.
npm install csv-parserVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to parse a CSV file with custom headers and options, piping a file stream through `csv-parser` and collecting results. This example includes setup and cleanup for a runnable script.
Upgrade Node.js to version 10 or later.
Review parsing results for CSV files with broken lines if upgrading from versions prior to v3.0.0, as behavior may differ.
When providing only headers: `csv(['Header1', 'Header2'])`. When providing options and headers: `csv({ separator: ',', headers: ['Header1', 'Header2'] })`.Upgrade to `csv-parser` v2.3.2 or later, which includes a fix for this specific interaction.
For ESM, use `import csv from 'csv-parser';`. For CommonJS, use `const csv = require('csv-parser');`. Ensure `csv()` is called as a function, not with `new`.Upgrade to `csv-parser` version 2.3.2 or later, which includes a fix for this specific interaction.
Upgrade to `csv-parser` version 3.0.0 or later, which contains a fix for this issue.
No dependency data recorded yet.