title: Reading a file into an array of lines in a system-independent manner
body: <p>In Node.js, when I want to read the lines of a file into an array, I do:</p>
  
  <pre><code>fs.readFileSync(filename).split('\r\n')
  </code></pre>
  
  <p>but this doesn't work on Linux. On Linux, I can do:</p>
  
  <pre><code>fs.readFileSync(filename).split('\n')
  </code></pre>
  
  <p>but this doesn't work on Windows. I can also do:</p>
  
  <pre><code>fs.readFileSync(filename).split(/[\r\n]+/)
  </code></pre>
  
  <p>which works on both systems, but hard to read.</p>
  
  <p>Is there a simple, system-independent way to read a file into an array of lines in Node.js? </p>