Skip to content

Local files watcher that uses a simple cyclic mechanism and does not require additional utilities to be installed.

License

Notifications You must be signed in to change notification settings

abatar1/CyclicalFileWatcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CyclicalFileWatcher
😼

A library for cyclical asynchronous file watching with subscription support.

Latest release Coveralls NuGet Version

Why CyclicalFileWatcher

Unlike another file watching solutions that rely on OS-level tools or native file system event hooks, CyclicalFileWatcher uses a simple polling mechanism to detect changes.

This approach:

  • Works consistently across platforms and environments (e.g. Docker, network drives, cloud volumes).
  • Requires no external dependencies, system utilities, or file system support.
  • Gives you full control over polling intervals and error handling.

It’s ideal for scenarios where reliability and isolation from the underlying OS are more important than real-time change detection.

Usage

var fileWatcher = new CyclicalFileWatcher<FileObject>(configuration);

await fileWatcher.WatchAsync(parameters, cancellationToken);

await fileWatcher.SubscribeAsync(filePath, async _ =>
{
    Console.WriteLine("Subscription action executed");
}, cancellationToken);

var latestFile = await fileWatcher.GetLatestAsync(filePath, cancellationToken);

See the full example in src/CyclicalFileWatcher.Test/Program.cs

License

Released under MIT by @EvgenyHalzov.

  • You can freely modify and reuse.
  • The original license must be included with copies of this software.
  • Please link back to this repo if you use a significant portion the source code.

About

Local files watcher that uses a simple cyclic mechanism and does not require additional utilities to be installed.

Topics

Resources

License

Stars

Watchers

Forks

Languages