No description
Find a file
2021-08-29 17:17:46 +04:30
src add config file to activate threads 2021-08-29 17:13:04 +04:30
tests add readme 2021-08-29 17:06:47 +04:30
.gitignore add tests 2021-08-29 16:47:50 +04:30
readme.md add changeFeed doc to readme 2021-08-29 17:17:46 +04:30
watch_for_files.nimble update readme 2021-08-29 17:08:55 +04:30

About

this is a cross-platform file watcher with database it means you can save into DB the lastest files modification times this special feature allows you to avoid unnecessary operations

How To use

let's take a look at the defination of the main proc goWatch

proc goWatch*(
  folder: string, 
  tunnel: ptr Channel[ChangeFeed], 
  active: ptr bool,
  timeInterval: int, 
  dbPath: string = "", 
  save: bool = false
)
  • folder: path to folder you wanna watch files changes, the program will watch file changes in any depths in that folder
  • tunnel: a ptr to channel: changes will be sent to this channel
  • active: a ptr to a bool: determines whether the worker [the file watcher] should continue to work or not
  • timeInterval: the delay between every check
  • dbPath: the database path
  • save: a boolean that indicates whether the files modifications state should be saved after every check or not

Note: if you specify dbPath and the file exists there, the saved state is going to be restored before the first check


the changes that will be sent to the channel are tuples of path & change_kind

  ChangeFeedVariants* = enum
    CFCreate, CFEdit, CFDelete

  ChangeFeed* = tuple
    path: string
    kind: ChangeFeedVariants

you can find the example of usage in tests/test.nim