title: throw new ERR_INVALID_ARG_TYPE('chunk',['string','Buffer'],chunk);TypeError[ERR_INVALID_ARG_TYPE]:The "chunk" arg must be type string or Buffer
body: <p>I am trying to get the contents of a <code>.json</code> file using a node js service into an angularjs method. But am getting following <strong>error:</strong></p>
  
  <blockquote>
    <p>_http_outgoing.js:700
          throw new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);
          ^
    TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be one of type string or Buffer. Received type object
        at ServerResponse.end (_http_outgoing.js:700:13)</p>
  </blockquote>
  
  <p>here are the corresponding code fragments...</p>
  
  <p><strong>angular controller:</strong> the commented lines are all of those which i have tried and failed with.</p>
  
  <pre><code>var currentProcess = "process_1cA";
  $scope.storestats = [];
  var resAss = $resource('/procs/getstorestats');
  var stats = resAss.get({
    process: currentProcess,
    date: date.getFullYear() + "" + m + "" + d
  });
  stats.$promise.then(function(response) {
    if (response != undefined) {
      //    var r = JSON.parse(response);
      //$scope.storestats.push(r);
      //$scope.storestats.push(r);
  
      //var r = JSON.parse(response);
      $scope.storestats.push(response);
      //angular.forEach(r, function(value, key) {
      //    $scope.storestats.push({key : value});
      //});
    }
  });
  </code></pre>
  
  <p><strong>NODEJs service:</strong></p>
  
  <pre><code>httpApp.get('/procs/getstorestats', function(req, res, next) {
  
  try {
      fs.readFile(cfg.routestatspath + "storestats-"+req.query.process + "-" + req.query.date + ".json", function (err, data) {
          var msgs1 = JSON.parse(data);
          //var r  = data.toString('utf8');
          var msgs2 = JSON.stringify(msgs1);
          console.log(msgs1);
          res.end(msgs1);
      });
  }
  catch (err) {
      res.end(err.toString());
  }});
  </code></pre>
  
  <p>P.S: <strong>The commented out lines are those which i have tried out with and failed. Also, the commented lines in the node service code snippet, give no error, and when logged show it correctly, but the data when in response of the controllers is blank.</strong></p>