CSV package for Node.js version 6

Version 6 of the csv package for Node.js is released along its sub projects. Here are the latest versions:

There has been a lot of commits since the last package was released, around 100, way to many to my opinion. Most of the efforts were on migrating to ECMAScript modules (ESM) and providing a robust build infrastructure based on Rollup. The website has been updated and enriched with many examples.

Before presenting the new features, here are the breaking changes first. Some module names have changed depending on your targeted environment. The documentation now provides extensive information and samples on this topic. Also, some options were renamed in the csv-parse package. There aren’t too many:

  • CommonJS users shall update the path to the sync modules, from package_name/lib/sync to package_name/sync.
  • Imports are always destructed, eg import parse from 'csv-parse', there are now default exports.
  • In the csv-parse package, option relax was renamed relax_quotes.
  • In the csv-parse package, option skip_lines_with_empty_values was renamed skip_records_with_empty_values.
  • In the csv-parse package, option skip_lines_with_error was renamed skip_records_with_error.
  • In the csv-parse package, error CSV_RECORD_DONT_MATCH_COLUMNS_LENGTH was renamed CSV_RECORD_INCONSISTENT_COLUMNS.
  • In the csv-parse package, error INCONSISTENT_RECORD_LENGTH was renamed RECORD_INCONSISTENT_FIELDS_LENGTH.

Here are the main features:

  • All projects and modules are now written as ECMAScript modules.
  • Transparent usage between CommonJS and ESM with package.json exports property
  • Wrote many samples integrated with the documentation website
  • Replace the browser distribution with the IIFE distribution generated by Rollup
  • New UMD distribution
  • Integrate lint rules on all js and coffee files
  • Backport compatibility with Node.js 8 in csv-stringify
  • In csv-parse, print current buffer with options skip_line_with_errors and raw
  • In csv-parse, option objname can now refer to index position
  • A few TypeScript enhancements

Here is a quick example illustrating some of the changes, using the csv-parse/lib/sync module. In the previous release, the code looked like:

const parse = require('csv-parse/lib/sync');
const records = parse('a, "b" ,c', 
  relax: true
);

In the latest release, the updated code is now:

// `parse` is now destructured, it is consistent with
// `const parse = require('csv/sync');` if you are using the `csv` package.
// Also, the path to the sync module is now 'csv-parse/sync'
const parse = require('csv-parse/sync');
const records = parse('a, "b" ,c', 
  // `relax` was renamed `relax_quotes`, this is one of the few options from
  // `csv-parse` which were renamed.
  relax_quotes: true
);

Please report bugs and propose features to the CSV repository on GitHub.

Related Posts

Big data infrastructure internship | Adaltas

Job description Big Data and distributed computing are at the core of Adaltas. We accompagny our partners in the deployment, maintenance, and optimization of some of the largest clusters in…

Placid Plastic Duck Simulator is Steam’s latest viral hit

In a nutshell: Not every game has to be massively engaging or come from a top-tier game studio to be a winner. Take a look at Placid Plastic Duck Simulator,…

Leave a Reply

You Missed

Top 10 Cybersecurity Services Every Cayman Business Should Invest in 2026

Top 10 Cybersecurity Services Every Cayman Business Should Invest in 2026

Erik Hosler Reveals the Human Realities Driving the 1000 to 1 Challenge

Erik Hosler Reveals the Human Realities Driving the 1000 to 1 Challenge

Introduction to Hotel 99 Kuala Lumpur City

Introduction to Hotel 99 Kuala Lumpur City

How a LinkedIn Marketing Agency Helps Businesses Build Authority and Generate Leads

How a LinkedIn Marketing Agency Helps Businesses Build Authority and Generate Leads

Time Well Spent: Top 8 Employee Time Tracking Tools for 2025

Time Well Spent: Top 8 Employee Time Tracking Tools for 2025

Ruby Jewelry for the Classic Woman: Timeless Elegance

Ruby Jewelry for the Classic Woman: Timeless Elegance