title: How to read file to variable in NodeJs?
body: <p>i'm pretty new into NodeJs. And i am trying to read a file into a variable.
  Here is my code.</p>
  
  <pre><code>var fs = require("fs"),
      path = require("path"),
      util = require("util");
          var content;
          console.log(content);
          fs.readFile(path.join(__dirname,"helpers","test.txt"), 'utf8',function (err,data) {
              if (err) {
                  console.log(err);
                  process.exit(1);
              }
              content = util.format(data,"test","test","test");
          });
          console.log(content);
  </code></pre>
  
  <p>But every time i run the script i get
  <code>undefined</code> and <code>undefined</code> </p>
  
  <p>What am i missing? Help please!</p>