I'm building a node.js app which will process a lot of numerical data. How do I store in memory data which has been read by fs.readFile, Example:
var somedata = ''; 
fs.readFile('somefile', 'utf8', function(err,data){
 somedata = data; 
});
//fs.readFile is done by now.. 
console.log(somedata) // undefined, why is this not in memory? 
I read file data periodically and currently I have to write what ive read elsewhere and read it again to use it in another function.
How do i just store it in memory? Is this just how javascript works??
 
    