fsutil

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasePathFile

type BasePathFile struct {
	afero.BasePathFile
}

func (*BasePathFile) Chmod

func (f *BasePathFile) Chmod(mode os.FileMode) error

func (*BasePathFile) Chown

func (f *BasePathFile) Chown(uid, gid int) error

type BasePathFs

type BasePathFs struct {
	afero.BasePathFs
}

func (*BasePathFs) Close

func (f *BasePathFs) Close() error

func (*BasePathFs) Lstat

func (f *BasePathFs) Lstat(path string) (os.FileInfo, error)

func (*BasePathFs) MkdirChmodChown

func (f *BasePathFs) MkdirChmodChown(path string, perm os.FileMode, uid, gid int) error

func (*BasePathFs) Open

func (f *BasePathFs) Open(path string) (File, error)

func (*BasePathFs) OpenFile

func (f *BasePathFs) OpenFile(path string, flag int, perm os.FileMode) (File, error)

func (*BasePathFs) ReadDir

func (f *BasePathFs) ReadDir(path string) ([]os.FileInfo, error)
func (f *BasePathFs) Readlink(p string) (string, error)
func (f *BasePathFs) Symlink(source, target string) error

type File

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

	Name() string
	Stat() (os.FileInfo, error)

	Chmod(mode os.FileMode) error
	Chown(uid, gid int) error
}

type Fs

type Fs struct {
	FsBackend
}

func NewBasePathFs

func NewBasePathFs(path string) Fs

func NewSftpFs

func NewSftpFs(client *sftp.Client, umask os.FileMode) Fs

func (Fs) AtomicWriteTo

func (f Fs) AtomicWriteTo(source io.WriterTo, target string, perm os.FileMode) error

AtomicWriteTo writes data to the named file, creating it if necessary. A failure mid-operation results in no changes to the file (if it existed).

func (Fs) CreateTemp

func (f Fs) CreateTemp(dir, pattern string, perm os.FileMode) (File, error)

CreateTemp is like os.CreateTemp, but it treats an empty dir as the current directory.

func (Fs) MkdirAll

func (f Fs) MkdirAll(path string, perm os.FileMode) error

MkdirAll creates a directory named path, along with any necessary parents.

func (Fs) MkdirAllChmodChown

func (f Fs) MkdirAllChmodChown(path string, perm os.FileMode, uid, gid int) error

MkdirAllChmodChown creates a directory named path, along with any necessary parents. New directories will have the specified permissions (ignoring umask) and ownership.

func (Fs) MkdirTemp

func (f Fs) MkdirTemp(dir, pattern string, perm os.FileMode) (string, error)

MkdirTemp is like os.MkdirTemp, but it treats an empty dir as the current directory.

func (Fs) ReadFile

func (f Fs) ReadFile(path string) ([]byte, error)

ReadFile reads the named file and returns the contents.

func (Fs) RemoveIfExists

func (f Fs) RemoveIfExists(path string) error

RemoveIfExists is like os.Remove, but ignores os.ErrNotExist.

func (Fs) SymlinkForce

func (f Fs) SymlinkForce(old, new string) error

SymlinkForce creates a symlink `new` pointing to `old`. If `new` already exists it is atomically overwritten.

func (Fs) WriteFile

func (f Fs) WriteFile(path string, data []byte, perm os.FileMode) error

WriteFile writes data to the named file, creating it if necessary. A failure mid-operation can leave the file in a partially written state.

type FsBackend

type FsBackend interface {
	io.Closer

	Mkdir(path string, perm os.FileMode) error
	MkdirChmodChown(path string, perm os.FileMode, uid, gid int) error
	Open(path string) (File, error)
	OpenFile(path string, flag int, perm os.FileMode) (File, error)
	Symlink(old, new string) error

	ReadDir(path string) ([]os.FileInfo, error)
	Stat(path string) (os.FileInfo, error)
	Lstat(path string) (os.FileInfo, error)
	Readlink(path string) (string, error)

	Rename(source, target string) error
	Chmod(path string, mode os.FileMode) error
	Chown(path string, uid, gid int) error
	Chtimes(path string, atime time.Time, mtime time.Time) error

	Remove(path string) error
	RemoveAll(path string) error
}

Jump to

Keyboard shortcuts

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