CSV package for Node.js version 6

CSV package for Node.js version 6

Do you like our work......we hire!

Never miss our publications about Open Source, big data and distributed systems, low frequency of one email every two months.

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.

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.

Share this article

Canada - Morocco - France

We are a team of Open Source enthusiasts doing consulting in Big Data, Cloud, DevOps, Data Engineering, Data Science…

We provide our customers with accurate insights on how to leverage technologies to convert their use cases to projects in production, how to reduce their costs and increase the time to market.

If you enjoy reading our publications and have an interest in what we do, contact us and we will be thrilled to cooperate with you.

Support Ukrain