# \[ANN\] BetterFileWatching 1.0: recursive file watching with easy API

**URL:** https://discourse.julialang.org/t/ann-betterfilewatching-1-0-recursive-file-watching-with-easy-api/137928
**Category:** Package Announcements
**Tags:** libuv, filewatching
**Created:** [July 3, 2026, 7:58pm UTC](https://discourse.julialang.org/t/ann-betterfilewatching-1-0-recursive-file-watching-with-easy-api/137928 "2026-07-03T19:58:27Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![fonsp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fonsp/32/222349_2.png) [@fonsp](https://discourse.julialang.org/u/fonsp)
#### Post date: [July 3, 2026, 7:58pm UTC](https://discourse.julialang.org/t/ann-betterfilewatching-1-0-recursive-file-watching-with-easy-api/137928/1 "2026-07-03T19:58:27Z")

</div>

Hi! 👋 I would like to announce [BetterFileWatching.jl](https://github.com/JuliaPluto/BetterFileWatching.jl) version 1.0!

```julia
watch_folder(f::Function, dir=".")

```

It is a file watching library (get notified when files change on disk) that can watch files and folders on all platforms. Unlike the [FileWatching stdlib](https://docs.julialang.org/en/v1/stdlib/FileWatching/), this library supports:

- **Recursive folder watching** : it can watch one folder, and all subfolders automatically
- **Watching contents** of directory files: watch for edits, not just new and deleted files in a directory
- **Callback API** : your function gets called on events. This means that _handling events does not prevent receiving new events_.

Version 1.0 has an even bigger CI test set that passes on Windows, Linux and MacOS. Version 1.0 is a complete rewrite. It’s now a pure Julia package with no binary dependencies and better performance.

# Example

Simple example:

```julia
watch_folder(".") do event
    @info "Something changed!" event
end

```

## CancellationToken

You can also watch a folder asynchronously, and stop it later with a [CancellationTokens.jl](https://github.com/davidanthoff/CancellationTokens.jl) token:

```julia-auto
using BetterFileWatching, CancellationTokens

src = CancellationTokenSource()

watch_task = @async watch_folder(".", get_token(src)) do event
    @info "Something changed!" event
end

sleep(5)

# stop watching the folder
cancel(src)

```

## Ignore function

There is also an `ignore` keyword to skip subtrees like `.git`. For example:

```julia-auto
watch_folder(".", token; ignore = rel -> ".git" in split(rel, "/")) do event
    # ...
end

```

# History _(coded with AI)_

This package was originally created by @Pangoraw and me in 2021, out of a need for recursive file watching in Julia, and we use it in [PlutoSliderServer.jl](https://github.com/JuliaPluto/PlutoSliderServer.jl). Version 0.1 used [Deno](https://deno.com/) wrapped in a JLL package to get their file watching API (which is very stable) in Julia. It worked fairly well, but the binary dependency and separate OS process was overkill.

I’m experimenting with AI coding recently, and I learned a technique from @quinnj and @pankgeorg to tell the robot to look at a well written implementation in another language, and translate that to Julia. So I used the implementation [from Bun, written in Rust](https://github.com/oven-sh/bun/tree/main/src/watcher), and the AI wrote the whole package in one go. I designed the API spec and wrote most of the communication. I reviewed some code, but I don’t understand the file system APIs, so I cannot review this part. It’s not a lot of code, so an outside reviewer would be welcome!

The result is really good! It is now a **pure Julia package** with no binary dependency, and no separate process. It uses `libuv` on MacOS and Windows, and `inotify` with `ccall` on Linux. More details are in the repository.

The package is free and open source! I hope it’s useful to you 🙂
