title: pipe streams to edit csv file in node.js
body: <p>I am basically trying to :</p>
  
  <ul>
  <li>open a csv file as a stream</li>
  <li>make some operation on each line </li>
  <li>stream the result into a second csv file</li>
  </ul>
  
  <p>in node.js.</p>
  
  <p>Here is my code :</p>
  
  <pre><code>var fs = require("fs");
  var csv = require("csv");
  
  var readStream = fs.createReadStream("input.csv");
  var writeStream = fs.createWriteStream("output.csv");
  
  var csvStream = csv
      .parse()
      .on("data", function(data){
      //do some stuff with data
      return(JSON.stringify(data));
      })
      .on("end", function(){
          console.log("done");
      })
      .on("error", function(error){
          console.log(error)
      });
  
  (readStream.pipe(csvStream)).pipe(writeStream);
  </code></pre>
  
  <p>I am getting "TypeError: Invalid non-string/buffer chunk". What am I doing wrong ? I am totally new to node.js, so please detail your answer.</p>