CSVGenerate for Node.js

IssuesGitHub

CSV Generate examples

This package proposes different API flavors. Every example is available on GitHub.

Using the pipe function

One useful function part of the Stream API is pipe to interact between multiple streams. You may use this function to pipe a stream.Readable source to a stream.Writable destination.

The pipe example, generates a dataset of 2 rows with 2 columns. The first columns contains integer values and the second column contains boolean values. It prints the generated dataset to stdout. the function generate return a readable stream which is then piped to process.stdout which is a writable stream.

import { generate } from 'csv-generate';

generate({
  columns: ['int', 'bool'],
  length: 2
})
  .pipe(process.stdout);

About

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