winfsnotify

package
v0.0.0-...-2824937 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2020 License: MIT, BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Rendered for windows/amd64

Overview

Package winfsnotify allows the user to receive file system event notifications on Windows.

Index

Constants

View Source
const (
	// Options for AddWatch
	FS_ONESHOT = 0x80000000
	FS_ONLYDIR = 0x1000000

	// Events
	FS_ACCESS      = 0x1
	FS_ALL_EVENTS  = 0xfff
	FS_ATTRIB      = 0x4
	FS_CLOSE       = 0x18
	FS_CREATE      = 0x100
	FS_DELETE      = 0x200
	FS_DELETE_SELF = 0x400
	FS_MODIFY      = 0x2
	FS_MOVE        = 0xc0
	FS_MOVED_FROM  = 0x40
	FS_MOVED_TO    = 0x80
	FS_MOVE_SELF   = 0x800

	// Special events
	FS_IGNORED    = 0x8000
	FS_Q_OVERFLOW = 0x4000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Mask   uint32 // Mask of events
	Cookie uint32 // Unique cookie associating related events (for rename)
	Name   string // File name (optional)
}

Event is the type of the notification messages received on the watcher's Event channel.

func (*Event) String

func (e *Event) String() string

String formats the event e in the form "filename: 0xEventMask = FS_ACCESS|FS_ATTRIB_|..."

type Watcher

type Watcher struct {
	Event chan *Event // Events are returned on this channel
	Error chan error  // Errors are sent on this channel
	// contains filtered or unexported fields
}

A Watcher waits for and receives event notifications for a specific set of files and directories.

func NewWatcher

func NewWatcher() (*Watcher, error)

NewWatcher creates and returns a Watcher.

func (*Watcher) AddWatch

func (w *Watcher) AddWatch(path string, flags uint32) error

AddWatch adds path to the watched file set.

func (*Watcher) Close

func (w *Watcher) Close() error

Close closes a Watcher. It sends a message to the reader goroutine to quit and removes all watches associated with the watcher.

func (*Watcher) RemoveWatch

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

RemoveWatch removes path from the watched file set.

func (*Watcher) Watch

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

Watch adds path to the watched file set, watching all events.

Jump to

Keyboard shortcuts

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