title: Printing a file to console received with a POST request in nodejs
body: <p>I'm receiving a json encoded file using nodejs and busboy. Now I want to read this file and print it on the console.</p>
  
  <p>I guess this should be easy, but somehow I don't get how to read and print the whole file..</p>
  
  <pre><code>router.addRoute('/', function (req, res, params) {
      if (req.method === 'POST') {
  
          var busboy = new Busboy({ headers: req.headers });
  
          busboy.on('file', function (fieldname, file, filename, encoding, mimetype) {
        console.log('File [' + fieldname + ']: filename: ' + filename + ', encoding: ' + encoding + ', mimetype: ' + mimetype);
  
              // We are streaming! Handle chunks
              file.on('data', function (data) {
          //read file
              });
  
              // Completed streaming the file.
              file.on('end', function () {
                  console.log('Finished with ' + fieldname);
              });
          });
  
          // Listen for event when Busboy is finished parsing the form.
          busboy.on('finish', function () {
              res.statusCode = 200;
              res.end();
          });
  
          req.pipe(busboy);
      }
  });
  </code></pre>