Skip to content

Instantly share code, notes, and snippets.

@TorbenKoehn
Created September 14, 2016 11:54
Show Gist options
  • Save TorbenKoehn/3896fe562ff2e7301a666dde392fef9b to your computer and use it in GitHub Desktop.
Save TorbenKoehn/3896fe562ff2e7301a666dde392fef9b to your computer and use it in GitHub Desktop.
var deferred = Q.defer();
FS.readFile("foo.txt", "utf-8", function (error, text) {
if (error) {
deferred.reject(new Error(error));
} else {
deferred.resolve(text);
}
});
return deferred.promise;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment