JavaScript function return is empty after file read
<p>this code</p>

<pre><code>var fs = require("fs");
var freeApps = readFile();
console.log('4' + freeApps.toString());

function readFile () {
    var content = '';
    fs.readFile(__dirname + "/public/json/" + "test.json", function(err, data) {
        if (err) {
            console.error(err);
            return '';
        }
        console.log('1' + data.toString());
        content = data;
        console.log('2' + content.toString());
    });
    console.log('3' + content.toString());
    return content;
}
</code></pre>

<p>returns</p>

<pre><code>3
4
1{"application":[{"name":"test","test":"name"}]}
2{"application":[{"name":"test","test":"name"}]}
</code></pre>

<p>where the letter is the test.json content. How could I properly read a file content and deal with it within the function ?
I succed to get the content at where 1 is and forward to another function but not within the function why is that ?</p>