fs

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 11 Imported by: 192

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileInfo

type FileInfo struct {
	FileName    string
	FileSize    int64
	FileMode    os.FileMode
	FileModTime time.Time
	FileIsDir   bool
	FileSys     interface{}
}

FileInfo is a struct which implements os.FileInfo. We use it (a) for test purposes, and (b) because we enrich the FileMode on Windows systems

func (*FileInfo) IsDir

func (fi *FileInfo) IsDir() bool

IsDir returns true if fi refers to a directory

func (*FileInfo) ModTime

func (fi *FileInfo) ModTime() time.Time

ModTime returns the file modification time of fi

func (*FileInfo) Mode

func (fi *FileInfo) Mode() os.FileMode

Mode returns the file mode of fi

func (*FileInfo) Name

func (fi *FileInfo) Name() string

Name retuns the filename of fi

func (*FileInfo) Size

func (fi *FileInfo) Size() int64

Size returns the file size of fi

func (*FileInfo) Sys

func (fi *FileInfo) Sys() interface{}

Sys returns the sys interface of fi

type FileSystem

type FileSystem interface {
	Chmod(file string, mode os.FileMode) error
	Rename(from, to string) error
	MkdirAll(dirname string) error
	MkdirAllWithPermissions(dirname string, perm os.FileMode) error
	Mkdir(dirname string) error
	Exists(file string) bool
	Copy(sourcePath, targetPath string, isIgnored func(path string) bool) error
	CopyContents(sourcePath, targetPath string, isIgnored func(path string) bool) error
	RemoveDirectory(dir string) error
	CreateWorkingDirectory() (string, error)
	Open(file string) (io.ReadCloser, error)
	Create(file string) (io.WriteCloser, error)
	WriteFile(file string, data []byte) error
	ReadDir(string) ([]os.FileInfo, error)
	Stat(string) (os.FileInfo, error)
	Lstat(string) (os.FileInfo, error)
	Walk(string, filepath.WalkFunc) error
	Readlink(string) (string, error)
	Symlink(string, string) error
	KeepSymlinks(bool)
	ShouldKeepSymlinks() bool
}

FileSystem allows STI to work with the file system and perform tasks such as creating and deleting directories

func NewFileSystem

func NewFileSystem() FileSystem

NewFileSystem creates a new instance of the default FileSystem implementation

Jump to

Keyboard shortcuts

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