localfs

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MkdirAllReset

func MkdirAllReset(path string, perm fs.FileMode) error

MkdirAllReset is same as os.MkdirAll except it deletes path before creating it.

func Save

func Save(f fs.FS, path string) error

Save saves file system f to path in the local file system.

func SaveBytesTemp

func SaveBytesTemp(data []byte, prefix string, perm os.FileMode) (path string, cleanup func(), err error)

SaveBytesTemp saves data bytes to a temporary file location at path.

func SaveTemp

func SaveTemp(f fs.FS) (path string, cleanup func(), err error)

SaveTemp saves file system f to a temporary path in the local file system and returns that path.

func Search(path, pattern string) ([]string, error)

Search searches for files in the fs with given glob pattern by ensuring that returned file paths are sorted.

func Watch

func Watch(ctx context.Context, paths []string, options ...WatcherOption) error

Watch starts watching changes on the paths. options are used to configure the behaviour of watch operation.

Types

type WatcherOption

type WatcherOption func(*watcher)

WatcherOption used to configure watcher.

func WatcherIgnoreExt

func WatcherIgnoreExt(exts ...string) WatcherOption

WatcherIgnoreExt ignores files with matching file extensions.

func WatcherIgnoreHidden

func WatcherIgnoreHidden() WatcherOption

WatcherIgnoreHidden ignores hidden(dot) files.

func WatcherOnChange

func WatcherOnChange(hook func()) WatcherOption

WatcherOnChange sets a hook that executed on every change on filesystem.

func WatcherPollingInterval

func WatcherPollingInterval(d time.Duration) WatcherOption

WatcherPollingInterval overwrites default polling interval to check filesystem changes.

func WatcherWorkdir

func WatcherWorkdir(path string) WatcherOption

WatcherWorkdir to set as a root to paths needs to be watched.

Jump to

Keyboard shortcuts

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