title: how to check how many lines of code in file using node js
body: <p>I tried to read line by line in file, but I have a doubt how to print count of line in file using <code>nodejs</code>.</p>
  
  <p><strong>data.js</strong></p>
  
  <pre><code>console.log("123")
  
  console.log("123")
  
  
  console.log("123")
  
  
  
  console.log("123")
  </code></pre>
  
  <p><strong>file.js</strong></p>
  
  <pre><code>var lineReader = require('readline').createInterface({
    input: require('fs').createReadStream('./data.js')
  });
  lineReader.on('line', function (line) {
    console.log('Line from file:', line);
  });
  </code></pre>
  
  <p>I got this ouput  </p>
  
  <blockquote>
    <p>Line from file: console.log("123")   Line from file:<br>
    Line from file: console.log("123")   Line from file:<br>
    Line from file:                       Line from file:
    console.log("123")   Line from file:                     Line from
    file:                     Line from file:                    Line from
    file: console.log("123")</p>
  </blockquote>
  
  <p>but I want how many lines of code in file using node js</p>