CSV for Node.js

IssuesGitHub

Callback API

Also available in the csv module is the callback API. The all dataset is available in the second callback argument. Thus it will not scale with large dataset. The callback example initialize each CSV function sequentially, with the output of the previous one. Note, for the sake of clarity, the example doesn't deal with error management. It is enough spaghetti code.

// Import the package
import {generate, parse, transform, stringify} from 'csv';

// Run the pipeline
generate({seed: 1, columns: 2, length: 20}, function(err, data){
  parse(data, function(err, data){
    transform(data, function(data){
      return data.map(function(value){return value.toUpperCase();});
    }, function(err, data){
      stringify(data, function(err, data){
        process.stdout.write(data);
      });
    });
  });
});

About

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