title: Reading a file using fs.createReadStream reads and extra trailing new line character, why?
body: <p>I am learning node.js and was trying to read a file using different methods. Here is how I read it using pipes and it read no extra character from the file and worked as expected</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const fs = require('fs');
  
  const readStream = fs.createReadStream('./file.txt', {
    encoding: 'utf8'
  });
  readStream.pipe(process.stdout);</code></pre>
  </div>
  </div>
  </p>
  
  <p>But when I tried to read the same file using the following method, it resulted in an extra trailing new line character <code>\n</code>.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const fs = require('fs');
  
  const readStream = fs.createReadStream('./file.txt', {
    encoding: 'utf8'
  });
  readStream.on('data', (chunk) =&gt; {
    console.log(chunk);
  });</code></pre>
  </div>
  </div>
  </p>
  
  <p>Why is the second method resulting in a trailing newline character?</p>