Permalink
Browse files

Update to include node-promise

  • Loading branch information...
1 parent 734cd56 commit 3b60ae99ba1130f72f3151a9b80e4dff7bace783 @kriszyp kriszyp committed Feb 24, 2010
Showing with 571 additions and 0 deletions.
  1. +17 −0 engines/node/lib/fs-promise.js
  2. +554 −0 engines/node/lib/promise.js
@@ -0,0 +1,17 @@
+/**
+* Node fs module that returns promises
+*/
+
+var fs = require("fs"),
+ convertNodeAsyncFunction = require("./promise").convertNodeAsyncFunction;
+
+// convert all the non-sync functions
+for (var i in fs) {
+ if (!(i.match(/Sync$/))) {
+ exports[i] = convertNodeAsyncFunction(fs[i]);
+ }
+}
+
+// convert the functions that don't have a declared callback
+exports.writeFile = convertNodeAsyncFunction(fs.writeFile, true);
+exports.readFile = convertNodeAsyncFunction(fs.readFile, true);
Oops, something went wrong.

0 comments on commit 3b60ae9

Please sign in to comment.