return value after a promise [duplicate]
Use a pattern along these lines: function getValue(file) { return lookupValue(file); } getValue(‘myFile.txt’).then(function(res) { // do whatever with res here }); (although this is a bit redundant, I’m sure your actual code is more complicated)