CSV Generate examples

Table of Contents

This package proposes different API flavours. 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.

const generate = require('csv-generate')
  columns: ['int', 'bool'],
  length: 2