title: I want to return the contents of file using node js
body: <p>I have written the following code in protractor.</p>
  
  <h2>helper.js:</h2>
  
  <pre><code>var fs = require('fs');
  helper = function(){
      this.blnReturn = function(){
          var filePath = '../Protractor_PgObjModel/Results/DontDelete.txt';
          fs.readFileSync(filePath, {encoding: 'utf-8'}, function (err, data){
              if (!err) {
                  console.log(data);
                  return data;
              } else {
                 return "False";
              }
          });
      };
  };
  module.exports = new helper();
  </code></pre>
  
  <p>------------actual file where the above js is being called-------------------</p>
  
  <pre><code>describe("read contents of file",function(){
    var helper = require("../GenericUtilities/helper.js");
    it('To Test read data',function(){
      console.log("helper test - " + helper.blnReturn());   
    });
  });
  </code></pre>
  
  <p>-------Output-------------</p>
  
  <pre><code>helper test - undefined
  </code></pre>
  
  <p>Any help in this regard is much appreciated as it is blocking my work. </p>