Skip to content
/ fzwatch Public

A lightweight and cross-platform file watcher for your Zig projects

License

Notifications You must be signed in to change notification settings

freref/fzwatch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fzwatch

A lightweight and cross-platform file watcher for your Zig projects.

Note

This project exists to support fancy-cat and has limited features.

Instructions

Run example

You can run the examples like so:

zig build run-<filename>

Usage

A basic example can be found under examples. The API is defined as follows:

pub const Event = enum { modified };
pub const Callback = fn (context: *anyopaque, event: Event) void;
pub const Opts = struct { latency: f16 = 1.0 };
 
pub fn init(allocator: std.mem.Allocator) !Watcher;
pub fn deinit(self: *Watcher) void;
pub fn addFile(self: *Watcher, path: []const u8) !void;
pub fn removeFile(self: *Watcher, path: []const u8) !void;
pub fn setCallback(self: *Watcher, callback: Callback) void;
pub fn start(self: *Watcher, opts: Opts) !void;
pub fn stop(self: *Watcher) !void;

About

A lightweight and cross-platform file watcher for your Zig projects

Topics

Resources

License

Stars

Watchers

Forks

Languages