title: nodejs express function not returning the variable from fs.readFile
body: <p>I have the following function in my nodejs, using express.</p>
  
  <pre><code>function metaInfo (id){
  
      var dir = 'files/'+id;
      var count = 0
  
      fs.readFile(__dirname +'/' + dir+'/myfile.json', 'utf8', function (err, data) {
  
          if (err) throw err;
          obj = JSON.parse(data);
          var myArr = obj.nodes;
          var count = Object.keys(myArr).length;
          console.log("counting :", count)
      });
  
      return count
  };
  </code></pre>
  
  <p>when I call this function, the <code>count</code> is zero, however, it is the right value inside the <code>fs.readFile</code> . how can I return the updated value of <code>count</code>?</p>