CSVParse for Node.js


Using pipe to connect multiple streams

Part of the Stream API, the pipe function is a precious tool used to wire multiple streams. The function is meant to connect a stream.Readable source to a stream.Writable destination.

The pipe example reads a file, parses its content, transforms it and print the result to the standard output.

This example is available with the command node samples/recipe.pipe.js.

const parse = require('csv-parse')
const generate = require('csv-generate')
const transform = require('stream-transform')

const generator = generate({
  length: 20
const parser = parse({
  delimiter: ':'
const transformer = transform(function(record, callback){
    callback(null, record.join(' ')+'\n')
  }, 500)
}, {
  parallel: 5