fshelper

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: Apache-2.0 Imports: 12 Imported by: 23

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Symlinkat

func Symlinkat(cwd, file, linkTo string) error

Symlinkat creates symlink relative to cwd rather actual working dir ref: https://man7.org/linux/man-pages/man2/symlink.2.html

Types

type OSFS

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

OSFS is a context aware filesystem abstration for afero.FS and io/fs.FS

func NewOSFS

func NewOSFS(
	strictIOFS bool,
	getCwd func() (string, error),
) *OSFS

NewOSFS creates a new filesystem abstraction for real filesystem set strictIOFS to true to only allow fs path value getCwd is used to determine current working dir, the string return value should be valid system file path

func (*OSFS) Abs

func (ofs *OSFS) Abs(name string) (string, error)

Abs is the filepath.Abs equivalent

func (*OSFS) Chmod

func (ofs *OSFS) Chmod(name string, mode fs.FileMode) error

Chmod is the os.Chmod equivalent

func (*OSFS) Chown

func (ofs *OSFS) Chown(name string, uid, gid int) error

Chown is the os.Chown equivalent

func (*OSFS) Chtimes

func (ofs *OSFS) Chtimes(name string, atime time.Time, mtime time.Time) error

Chtimes is the os.Chtimes equivalent

func (*OSFS) Create

func (ofs *OSFS) Create(name string) (fs.File, error)

Create is the os.Create equivalent

func (*OSFS) Glob

func (ofs *OSFS) Glob(pattern string) ([]string, error)

Glob implements fs.GlobFS with `**` support

func (*OSFS) Lstat

func (ofs *OSFS) Lstat(name string) (fs.FileInfo, error)

Lstat is the os.Lstat equivalent

func (*OSFS) Mkdir

func (ofs *OSFS) Mkdir(name string, perm fs.FileMode) error

Mkdir is the os.Mkdir equivalent

func (*OSFS) MkdirAll

func (ofs *OSFS) MkdirAll(name string, perm fs.FileMode) error

MkdirAll is the os.MkdirAll equivalent

func (*OSFS) Open

func (ofs *OSFS) Open(name string) (fs.File, error)

Open is the os.Open equivalent implements fs.FS

func (*OSFS) OpenFile

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

OpenFile is the os.OpenFile equivalent

func (*OSFS) ReadDir

func (ofs *OSFS) ReadDir(name string) ([]fs.DirEntry, error)

ReadDir is the os.ReadDir equivalent implements fs.ReadDirFS

func (*OSFS) ReadFile

func (ofs *OSFS) ReadFile(name string) ([]byte, error)

ReadFile is the os.ReadFile equivalent implements fs.ReadFileFS

func (ofs *OSFS) Readlink(name string) (string, error)

Readlink is the os.Readlink equivalent

func (*OSFS) Remove

func (ofs *OSFS) Remove(name string) error

Remove is the os.Remove equivalent

func (*OSFS) RemoveAll

func (ofs *OSFS) RemoveAll(name string) error

RemoveAll is the os.RemoveAll equivalent

func (*OSFS) Rename

func (ofs *OSFS) Rename(oldname, newname string) error

Rename is the os.Rename equivalent

func (*OSFS) SetStrict

func (ofs *OSFS) SetStrict(s bool) *OSFS

SetStrict sets strict mode to require io/fs.FS path value

func (*OSFS) SetWindowsFHSLookup

func (ofs *OSFS) SetWindowsFHSLookup(lookup func(path string) (string, error)) *OSFS

func (*OSFS) Stat

func (ofs *OSFS) Stat(name string) (fs.FileInfo, error)

Stat is the os.Stat equivalent

func (*OSFS) Sub

func (ofs *OSFS) Sub(dir string) (fs.FS, error)

Sub implements fs.SubFS

func (ofs *OSFS) Symlink(oldname, newname string) error

Symlink is the os.Symlink equivalent

func (*OSFS) WriteFile

func (ofs *OSFS) WriteFile(name string, data []byte, perm fs.FileMode) error

WriteFile is the os.WriteFile equivalent

Jump to

Keyboard shortcuts

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