nl_tokens: Takes a folder root and a callback and recurses through to a directory tree Calls fn ( null directory ) whenever a file is added to one of the watched directories
pl_tokens: function ( fPath , fnAdd , fnRemove , depth ) { fs . stat ( fPath , function onStat ( err , stats ) { if ( err ) { return fnAdd && fnAdd ( err ) ; } if ( stats . isDirectory ( ) && depth > 0 ) { //If we have a directory, watch it and recurse down watcher . checkFile ( fPath , options . strict , function _checkFile ( err , result ) { if ( err ) { return fnAdd && fnAdd ( err ) ; } if ( ! result ) { watcher . addFile ( fPath , function _addFile ( ) { //Clear out any old listeners. Is there a better way? if ( typeof ( handles [ fPath ] ) === 'object' ) { handles [ fPath ] . close ( ) ; } handles [ fPath ] = fs . watch ( fPath , folderChanged ( fPath , fnAdd , fnRemove ) ) ; } ) ; } } ) ; //Recurse over anything in this directory fs . readdir ( fPath , function _readdir ( err , files ) { if ( err ) { return fnAdd && fnAdd ( err ) ; } files . forEach ( function ( file ) { if ( file [ 0 ] === '.' ) { return ; } //ignore files starting with "." var rPath = path . <mask> ( fPath , file ) ; //            console.log('depth later ' + depth) watchFolderTree ( rPath , fnAdd , fnRemove , depth - 1 ) ; } ) ; } ) ; } else if ( stats . isFile ( ) ) { watcher . checkFile ( fPath , options . strict , function _checkFile ( err , result ) { if ( err ) { return fnAdd && fnAdd ( err ) ; } if ( ! result ) { watcher . addFile ( fPath , function _addFile ( ) { //If startSilent has been requested, do not fire the callbacks on first read of the directory  if ( ! options . startSilent ) { return fnAdd && fnAdd ( null , fPath ) ; } } ) ; } } ) ; } } ) ; }