title: Returning the line of a searched text from a file using node.js
body: <p>I am using fs to read the contents of a file, and then searching for a particular word within that file, if the file contains that word instead of returning boolean or the word, I want the output the line that contains the keyword. How do I output that entire line?</p>
  
  <pre><code>const fs = require("fs");
  let file = fs.readFileSync("read.txt", "utf8");
  if(file.indexOf("keyword") &gt;= 0) {
      console.log("Line of the keyword");
  }
  </code></pre>
  
  <p>I only want the console.log() to output the line if that line contains the keyword.</p>