fsn

package
v1.8.95 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: LGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventHandlers added in v1.8.87

type EventHandlers struct {
	OnCreate func(string)
	OnWrite  func(string)
	OnRemove func(string)
	OnRename func(string)
	OnChmod  func(string)
}

EventHandlers holds the functions to be called on various file system events.

type Watcher

type Watcher struct {

	// Event handlers
	OnCreate func(string)
	OnWrite  func(string)
	OnRemove func(string)
	OnRename func(string)
	OnChmod  func(string)
	// contains filtered or unexported fields
}

Watcher monitors file system events using fsnotify.

func NewFsnWatcher

func NewFsnWatcher(includeExts []string) (*Watcher, error)

NewFsnWatcher creates a new Watcher with the specified file extensions.

func StartWatcher added in v1.8.87

func StartWatcher(dirs []string, exts []string, handlers EventHandlers) (*Watcher, error)

StartWatcher initializes the watcher, adds directories, sets event handlers, and starts monitoring.

func (*Watcher) AddDirRecursive

func (w *Watcher) AddDirRecursive(path string) error

AddDirRecursive adds directories and subdirectories to the watch list recursively.

func (*Watcher) Close

func (w *Watcher) Close() error

Close stops the file watcher and releases resources.

func (*Watcher) Start

func (w *Watcher) Start()

Start begins the main loop for file monitoring and event handling.

Jump to

Keyboard shortcuts

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