Skip to content

Commit

Permalink
Updates to promised-io for narwhal/nodules
Browse files Browse the repository at this point in the history
  • Loading branch information
kriszyp committed Aug 18, 2010
1 parent e1d4631 commit 9059d10
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
17 changes: 13 additions & 4 deletions lib/fs.js
Expand Up @@ -2,13 +2,21 @@
* Node fs module that returns promises
*/

var fs = require("fs"),
LazyArray = require("./lazy-array").LazyArray,
var fs = require("fs");

if(typeof process == "undefined"){
// for rhino
for(var i in fs){
exports[i] = fs[i];
}
}
else{
var LazyArray = require("./lazy-array").LazyArray,
Buffer = require("buffer").Buffer,
defer = require("./promise").defer,
when = require("./promise").when,
convertNodeAsyncFunction = require("./promise").convertNodeAsyncFunction;

// convert all the non-sync functions
for (var i in fs) {
if (i.match(/Sync$/) || i.match(/watch/)) {
Expand Down Expand Up @@ -151,4 +159,5 @@ exports.makeTree = function(path){
};
exports.absolute = exports.realpathSync;
exports.list = exports.readdirSync;
exports.move = exports.rename;
exports.move = exports.rename;
}
5 changes: 5 additions & 0 deletions package.json
Expand Up @@ -19,6 +19,11 @@
"npm": {
"main": "./lib/fs",
"directories": { "lib": "./lib" }
},
"narwhal": {
"mappings": {
"fs": "../engines/rhino/lib/fs.js"
}
}
}
}

0 comments on commit 9059d10

Please sign in to comment.