CSVStringify for Node.js

IssuesGitHub

Node.js CommonJS (CJS)

The CommonJS distribution is appropriate to Node.js packages which have not yet migrated to ECMAScript modules. It is available in your code with:

  • Stream and callback API: const {stringify} = require('csv-stringify');
  • Sync API: const {stringify} = require('csv-stringify/sync');

Addtionnal information are available in the project CommonJS documentation.

Supported Node.js versions

The CommonJS distribution of this package supports the usage of Node.js version 8.3 and above. However, the module path differs depending on your Node.js version.

Internally, the export property inside the package.json file declares the csv-stringify and csv-stringify/sync entry points. It exposes the modules of the ./dist/cjs folder.

It is supported in Node.js 12+ as an alternative to the main field. For older version, the main field behave as a fallback of the csv module. It is transparent. Use require("csv/dist/cjs/sync.cjs") as an alternative to require("csv/sync").

Older versions of this package

In version 2 and below, the module signature was:

const stringify = require('csv-stringify');
// And
const stringify = require('csv-stringify/lib/sync');

About

The Node.js CSV project is an open source product hosted on GitHub and developed by Adaltas.