Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add wrapper for fs.watch to vfs-local

  • Loading branch information...
commit 639f4d485d2261bb75ba495f7c5506817d931d11 1 parent 21f2b30
@creationix creationix authored
Showing with 20 additions and 0 deletions.
  1. +20 −0 local/localfs.js
View
20 local/localfs.js
@@ -85,6 +85,9 @@ module.exports = function setup(fsOptions) {
copy: copy,
symlink: symlink,
+ watch: watch,
+ getchanges: getchanges,
+
// for internal use only
killtree: killtree
};
@@ -732,5 +735,22 @@ module.exports = function setup(fsOptions) {
});
});
}
+
+ // Simple wrapper around node's fs.watch function. Returns a watcher object
+ // that emits "change" events. Make sure to call .close() when done to
+ // prevent leaks.
+ function watch(path, options, callback) {
+ var meta = {};
+ realpath(path, function (err, path) {
+ if (err) return callback(err);
+ meta.watcher = fs.watch(path, options, function (event, filename) {});
+ callback(null, meta);
+ });
+ }
+
+ function getchanges(path, options, callback) {
+ callback(new Error("Not implemented"));
+ }
+
};
Please sign in to comment.
Something went wrong with that request. Please try again.