title: createReadStream in Node.JS
body: <p>So I used fs.readFile() and it gives me </p>
  
  <blockquote>
    <p>"FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of
    memory"</p>
  </blockquote>
  
  <p>since fs.readFile() loads the whole file into memory before calling the callback, should I use fs.createReadStream() instead? </p>
  
  <p>That's what I was doing previously with readFile:</p>
  
  <pre><code>fs.readFile('myfile.json', function (err1, data) {
      if (err1) {
          console.error(err1);
      } else {
          var myData = JSON.parse(data);
          //Do some operation on myData here
      }
  }
  </code></pre>
  
  <p>Sorry, I'm kind of new to streaming; is the following the right way to do the same thing but with streaming?</p>
  
  <pre><code>var readStream = fs.createReadStream('myfile.json');
  
  readStream.on('end', function () {  
      readStream.close();
      var myData = JSON.parse(readStream);
      //Do some operation on myData here
  });
  </code></pre>
  
  <p>Thanks</p>