gofs

package
v0.0.0-...-244c41e Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0 Imports: 8 Imported by: 5

Documentation

Index

Constants

View Source
const DefaultMaxConcurrency = 1

Variables

This section is empty.

Functions

func IsSymlink(fileMode fs.FileMode) bool

func Walk

func Walk(fs Fs, path string, walkFunc filepath.WalkFunc, options WalkOptions) error

Walk walks a tree concurrently If options.MaxConcurrency is set to >1, any actions you do in the provided walkFunc must be synchronized (or not need to be synchronized)

Types

type File

type File interface {
	io.Closer
	io.Reader
	io.ReaderAt
	io.Seeker
	io.Writer
	io.WriterAt

	Name() string
	Readdir(count int) ([]os.FileInfo, error)
	Readdirnames(n int) ([]string, error)
	Stat() (os.FileInfo, error)
	Sync() error
	Truncate(size int64) error
	WriteString(s string) (ret int, err error)
}

afero's interface for a File

type Fs

type Fs interface {
	Create(name string) (File, error)
	Remove(path string) error
	RemoveAll(path string) error
	Stat(path string) (os.FileInfo, error)
	Lstat(path string) (os.FileInfo, error)
	ReadDir(dirname string) ([]os.FileInfo, error)
	ReadFile(path string) ([]byte, error)
	Mkdir(path string, perm os.FileMode) error
	MkdirAll(path string, perm os.FileMode) error
	Open(path string) (File, error)
	WriteFile(path string, data []byte, perm os.FileMode) error
	Rename(old, new string) error
	OpenFile(name string, flag int, perm os.FileMode) (File, error)
	Symlink(oldName, newName string) error
	Chmod(name string, mode os.FileMode) error
	Readlink(path string) (string, error)
}

type OsFs

type OsFs struct{}

func NewOsFs

func NewOsFs() *OsFs

func (*OsFs) Chmod

func (fs *OsFs) Chmod(name string, mode os.FileMode) error

func (*OsFs) Create

func (fs *OsFs) Create(name string) (File, error)

func (*OsFs) Lstat

func (fs *OsFs) Lstat(path string) (os.FileInfo, error)

func (*OsFs) Mkdir

func (fs *OsFs) Mkdir(path string, perm os.FileMode) error

func (*OsFs) MkdirAll

func (fs *OsFs) MkdirAll(path string, perm os.FileMode) error

func (*OsFs) Open

func (fs *OsFs) Open(name string) (File, error)

func (*OsFs) OpenFile

func (fs *OsFs) OpenFile(name string, flag int, perm os.FileMode) (File, error)

func (*OsFs) ReadDir

func (fs *OsFs) ReadDir(path string) ([]os.FileInfo, error)

func (*OsFs) ReadFile

func (fs *OsFs) ReadFile(path string) ([]byte, error)
func (fs *OsFs) Readlink(path string) (string, error)

func (*OsFs) Remove

func (fs *OsFs) Remove(path string) error

func (*OsFs) RemoveAll

func (fs *OsFs) RemoveAll(path string) error

func (*OsFs) Rename

func (fs *OsFs) Rename(oldname, newname string) error

func (*OsFs) Stat

func (fs *OsFs) Stat(path string) (os.FileInfo, error)
func (fs *OsFs) Symlink(oldname, newname string) error

func (*OsFs) WriteFile

func (fs *OsFs) WriteFile(path string, data []byte, perm os.FileMode) error

type WalkOptions

type WalkOptions struct {
	IncludesMatcher,
	ExcludesMatcher patternmatcher.Matcher
	MaxConcurrency uint
	// FollowSymlinks treats a symlink as if it were the file/directory underneath, effectively hiding the symlink from the consumer.
	// It can be used with a chain of symlinks, in which case it will keep following the links, until it reaches a non-symlink
	FollowSymlinks bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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