I have this:
var parseFile = function(err, data) {
// I need to access 'myFile'
};
fs.readFile(myFile, 'utf8', parseFile);
How can I access 'myFile' within the callback declared elsewhere?
function parseFile(myFile) {
return function (err, data) {
// its a closure bound variable! yay.
}
}
fs.readFile(myFile, "utf8", parseFile(myFile))