Skip to content

Instantly share code, notes, and snippets.

@hns
Created April 23, 2010 12:36
Show Gist options
  • Save hns/376498 to your computer and use it in GitHub Desktop.
Save hns/376498 to your computer and use it in GitHub Desktop.
Compatibility shim for modules using Narwhal's file module
var map = {
base: "basename",
changeWorkingDirectory: "chdir",
workingDirectory: "cwd",
directory: "dirname",
makeDirectory: "mkdir",
makeTree: "mkdirs",
lastModified: "mtime",
removeDirectory: "rmdir",
removeTree: "rmtree",
link: "symlink"
};
var fs = require("fs");
var key, name;
for (key in fs) {
name = map[key] || key;
exports[name] = fs[key];
}
for (key in fs.Path.prototype) {
name = map[key] || key;
fs.Path.prototype[name] = fs.Path.prototype[key];
}
exports.cwdPath = function() {
return new exports.Path(exports.cwd());
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment