I have the below function, which reads text from a file and outputs the text into the data variable.
fs.readFile('a1.txt', 'utf8', function(err, data) {
if (err) throw err;
console.log(data);
});
I want to assign data to a global variable so i can use it in other parts of my program. at the moment I am unable to use the information taken from data. What can I do to store data into another variable which i can use freely in other functions?