fsext

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2019 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCacheOnReadFs

func NewCacheOnReadFs(base, layer afero.Fs, cacheTime time.Duration) afero.Fs

NewCacheOnReadFs returns a new CacheOnReadFs

func Walk

func Walk(fs afero.Fs, root string, walkFn filepath.WalkFunc) error

Walk implements afero.Walk, but in a way that it doesn't loop to infinity and doesn't have problems if a given path part looks like a windows volume name

Types

type CacheOnReadFs

type CacheOnReadFs struct {
	afero.Fs
	// contains filtered or unexported fields
}

CacheOnReadFs is wrapper around afero.CacheOnReadFs with the ability to return the filesystem that is used as cache

func (CacheOnReadFs) GetCachingFs

func (c CacheOnReadFs) GetCachingFs() afero.Fs

GetCachingFs returns the afero.Fs being used for cache

type ChangePathFile

type ChangePathFile struct {
	afero.File
	// contains filtered or unexported fields
}

ChangePathFile is a file from ChangePathFs

func (*ChangePathFile) Name

func (f *ChangePathFile) Name() string

Name Returns the name of the file

type ChangePathFs

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

ChangePathFs is a filesystem that wraps another afero.Fs and changes all given paths from all file and directory names, with a function, before calling the same method on the wrapped afero.Fs. Heavily based on afero.BasePathFs

func NewChangePathFs

func NewChangePathFs(source afero.Fs, fn ChangePathFunc) *ChangePathFs

NewChangePathFs return a ChangePathFs where all paths will be change with the provided funcs

func NewTrimFilePathSeparatorFs

func NewTrimFilePathSeparatorFs(source afero.Fs) *ChangePathFs

NewTrimFilePathSeparatorFs is ChangePathFs that trims a Afero.FilePathSeparator from all paths Heavily based on afero.BasePathFs

func (*ChangePathFs) Chmod

func (b *ChangePathFs) Chmod(name string, mode os.FileMode) (err error)

Chmod changes the mode of the named file to mode.

func (*ChangePathFs) Chtimes

func (b *ChangePathFs) Chtimes(name string, atime, mtime time.Time) (err error)

Chtimes changes the access and modification times of the named file

func (*ChangePathFs) Create

func (b *ChangePathFs) Create(name string) (f afero.File, err error)

Create creates a file in the filesystem, returning the file and an error, if any happens

func (*ChangePathFs) LstatIfPossible

func (b *ChangePathFs) LstatIfPossible(name string) (os.FileInfo, bool, error)

LstatIfPossible implements the afero.Lstater interface

func (*ChangePathFs) Mkdir

func (b *ChangePathFs) Mkdir(name string, mode os.FileMode) (err error)

Mkdir creates a directory in the filesystem, return an error if any happens.

func (*ChangePathFs) MkdirAll

func (b *ChangePathFs) MkdirAll(name string, mode os.FileMode) (err error)

MkdirAll creates a directory path and all parents that does not exist yet.

func (*ChangePathFs) Name

func (b *ChangePathFs) Name() string

Name return the name of this FileSystem

func (*ChangePathFs) Open

func (b *ChangePathFs) Open(name string) (f afero.File, err error)

Open opens a file, returning it or an error, if any happens.

func (*ChangePathFs) OpenFile

func (b *ChangePathFs) OpenFile(name string, flag int, mode os.FileMode) (f afero.File, err error)

OpenFile opens a file using the given flags and the given mode.

func (*ChangePathFs) Remove

func (b *ChangePathFs) Remove(name string) (err error)

Remove removes a file identified by name, returning an error, if any happens.

func (*ChangePathFs) RemoveAll

func (b *ChangePathFs) RemoveAll(name string) (err error)

RemoveAll removes a directory path and any children it contains. It does not fail if the path does not exist (return nil).

func (*ChangePathFs) Rename

func (b *ChangePathFs) Rename(oldName, newName string) (err error)

Rename renames a file.

func (*ChangePathFs) Stat

func (b *ChangePathFs) Stat(name string) (fi os.FileInfo, err error)

Stat returns a FileInfo describing the named file, or an error, if any happens.

type ChangePathFunc

type ChangePathFunc func(name string) (path string, err error)

ChangePathFunc is the function that will be called by ChangePathFs to change the path

Jump to

Keyboard shortcuts

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