Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Zig asynchronous directory file change watcher library for Windows, macOS and Linux.

License

Notifications You must be signed in to change notification settings

darltrash/zigmon

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zig bindings for the C library dmon.

Getting started

zig fetch --save git+https://github.com/OsakiTsukiko/zigmon

Then in your build.zig add:

const zigmon = b.dependency("zigmon", .{});
exe.root_module.addImport("zigmon", zigmon.module("zigmon"));

Example Code

const std = @import("std");
const zm = @import("zigmon");

const Watcher = zm.Watcher(i64);

fn on_change(watcher: Watcher, _: zm.Action, _: []const u8, _: ?[]const u8) void {
    std.debug.print("\nSomething happened ({}):\n", .{watcher.data});
}

pub fn main() !void {
    zm.init();
    defer zm.deinit();

    var my_watcher: Watcher = .{
        .root = ".",
        .data = 1337,

        .on_change = on_change,
    };
    try my_watcher.watch();
    defer my_watcher.unwatch();
}

Demos

# Will run src/demos/main.zig (wrapper)
zig build demo

# Will run src/demos/raw.zig (native)
zig build demo-raw

Useful

To better understand how to use, look into src/demos/main.zig and src/demos/raw.zig (for the raw version of this binding).

Note: Used by Makko

About

Zig asynchronous directory file change watcher library for Windows, macOS and Linux.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 88.4%
  • Zig 11.6%