Fs
Go package exposing APIs to watch unix file systems.
Install / Use
/learn @segmentio/FsREADME
fs
Go package exposing minimal APIs to watch unix file systems.
Motivation
Go has long had a package to receive notification from file system
changes: fsnotify.
The package took on the challenging task to provide cross-platform solution,
and inherits complexity and limitations. One of these limitations is the
inability to watch for changes on symbolic links, which adds barriers to using
fsnotify in contexts like kubernetes config maps (which are exposed to pods
via symbolic links).
The fs package aims to address these limitations by giving up some of the
cross-platform goals and providing a simpler API mirrored after the standard
signal package.
Usage Example
A key difference of the fs package is it installs one-shot notifications
instead of persistent watchers. This design decision was made after observing
that programs tend to make adjustments to the watchers after each event,
especially when files are created, removed, or renamed, the persistence ends
up forcing complexity on the program.
import (
"github.com/segmentio/fs"
)
...
for {
ch := make(chan string)
if err := fs.Notify(ch, "/dir", "/dir/file"); err != nil {
return err
}
select {
case path := <-ch:
switch path {
case "/dir":
...
case "/dir/file":
...
}
case <-ctx.Done():
fs.Stop(ch)
return ctx.Err()
}
}
Related Skills
xurl
351.2kA CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.
openpencil
2.1kThe world's first open-source AI-native vector design tool and the first to feature concurrent Agent Teams. Design-as-Code. Turn prompts into UI directly on the live canvas. A modern alternative to Pencil.
wanwu
4.3kChina Unicom's Yuanjing Wanwu Agent Platform is an enterprise-grade, multi-tenant AI agent development platform. It helps users build applications such as intelligent agents, workflows, and rag, and also supports model management. The platform features a developer-friendly license, and we welcome all developers to build upon the platform.
HappyColorBlend
HappyColorBlendVibe Project Guidelines Project Overview HappyColorBlendVibe is a Figma plugin for color palette generation with advanced tint/shade blending capabilities. It allows designers to
