Skip to content

Instantly share code, notes, and snippets.

@guanix
Created February 16, 2010 00:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guanix/305163 to your computer and use it in GitHub Desktop.
Save guanix/305163 to your computer and use it in GitHub Desktop.
open("path.tmp")
.then(function (stream) {
return stream.write("some text");
}).then(function (stream) {
return stream.close();
}).then(function () {
return rename("path.tmp", "path");
}, function (e) {
// one error handler for an error at any point in the chain
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment