filewatcher

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeEvent

type ChangeEvent struct {
	Path      string    // Path to the changed file
	Timestamp time.Time // Time of the change
	Error     error     // Error if any occurred during processing
}

ChangeEvent represents a file change event

type ChangeListener

type ChangeListener interface {
	OnFileChange(event ChangeEvent)
}

ChangeListener is an interface for receiving file change notifications

type Watcher

type Watcher struct {
	// contains filtered or unexported fields
}

Watcher monitors file changes and notifies listeners with debounce support

func NewWatcher

func NewWatcher(filePath string, debounceDelay time.Duration) (*Watcher, error)

NewWatcher creates a new file watcher with the specified debounce delay

func (*Watcher) AddListener

func (w *Watcher) AddListener(listener ChangeListener)

AddListener adds a listener to receive file change notifications

func (*Watcher) Close

func (w *Watcher) Close() error

Close stops the watcher and releases resources

func (*Watcher) Start

func (w *Watcher) Start(ctx context.Context) error

Start begins watching for file changes This is a blocking call and should typically be run in a goroutine

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL