UNPKG

fswatch

Version:

Node.js file system events watcher

35 lines (26 loc) 902 B
var yfw = require('yanlibs/lib/yanfwatch'), yfs = require('yanlibs/lib/yanfs'), fswapi = require('fswatch/lib/fswatchapi'), watchers = {}; exports.setLog = function(logf) { yfw.setLog(logf); }; exports.startQueue = function(interval) { yfw.start(interval); }; exports.registerParser = function(parserid, module) { yfw.registerParser(parserid, module); }; exports.registerWatcher = function(watcherid, module) { watchers[watcherid] = module; }; exports.addPath = function(path, mask, evpath) { for (var watcher in watchers) watchers[watcher].addPath(path, mask, evpath); }; exports.addPathAll = function(path, evpath) { exports.addPath(path, fswapi.ALL, evpath); }; exports.subscribe = function(evpath, evmatcher, evpreprocessor, callbacks) { return yfw.subscribe(evpath, yfs.getMatcher(evmatcher), evpreprocessor, callbacks); }; exports.exec = yfw.exec;