polly

Package Version Hex Docs

Polly is a portable, polling file-system watcher, supporting the Erlang and Node.js target.

While she may not be the fastest, she will help you in all situations where the fs package might not be suitable or supported.

gleam add polly@1
import gleam/io
import polly

pub fn main() {
  polly.new()
  |> polly.add_dir("src")
  |> polly.interval(1000)
  |> polly.watch(fn(event) {
    case event {
      Changed(path) -> io.println("CHANGED " <> path)
      Created(path) -> io.println("CREATED " <> path)
      Deleted(path) -> io.println("DELETED " <> path)
    }
  })
}

Further documentation can be found at https://hexdocs.pm/polly.

Search Document