Node.js ECMAScript modules (ESM)
The csv-generate
package is written as ECMAScript modules. It is available in your code with:
- Stream and callback API:
import {generate} from 'csv-generate';
- Sync API:
import {generate} from 'csv-generate/sync';
Addtionnal information are available in the csv
ESM documentation.
Implementation
Internally, the export
property inside the package.json
file exposes the modules in the ./lib
folder.
Supported Node.js versions
According to our tests, ECMAScript modules started to work with this package and with Node.js version 12.16 when the --experimental-modules
flag activated. Starting with version 12.17, the usage of the --experimental-modules
flag was no longer required.
The CommonJS distribution supports older version of Node.js starting with version 8.3.
Older versions of this package
ECMAScript modules support came with version 3.0.0 of csv-generate
. Prior versions shall refer to the CommonJS documentation.