Skip to content

Commit

Permalink
Update to include node-promise
Browse files Browse the repository at this point in the history
  • Loading branch information
kriszyp committed Feb 24, 2010
1 parent 734cd56 commit 3b60ae9
Show file tree
Hide file tree
Showing 2 changed files with 571 additions and 0 deletions.
17 changes: 17 additions & 0 deletions engines/node/lib/fs-promise.js
Original file line number Diff line number Diff line change
@@ -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);
Loading

0 comments on commit 3b60ae9

Please sign in to comment.