Documentation
¶
Index ¶
- Variables
- type Path
- func (p *Path) Chmod(mode os.FileMode) error
- func (p *Path) Chtimes(atime time.Time, mtime time.Time) error
- func (p *Path) Create() (afero.File, error)
- func (p *Path) DirExists() (bool, error)
- func (p *Path) Equals(other *Path) (bool, error)
- func (p *Path) Exists() (bool, error)
- func (p *Path) FileContainsAnyBytes(subslices [][]byte) (bool, error)
- func (p *Path) FileContainsBytes(subslice []byte) (bool, error)
- func (p *Path) Fs() afero.Fs
- func (p *Path) GetLatest() (*Path, error)
- func (p *Path) Glob(pattern string) ([]*Path, error)
- func (p *Path) IsAbsolute() bool
- func (p *Path) IsDir() (bool, error)
- func (p *Path) IsEmpty() (bool, error)
- func (p *Path) IsFile() (bool, error)
- func (p *Path) IsSymlink() (bool, error)
- func (p *Path) Join(elems ...string) *Path
- func (p *Path) Mkdir(perm os.FileMode) error
- func (p *Path) MkdirAll(perm os.FileMode) error
- func (p *Path) Mtime() (time.Time, error)
- func (p *Path) Name() string
- func (p *Path) Open() (afero.File, error)
- func (p *Path) OpenFile(flag int, perm os.FileMode) (afero.File, error)
- func (p *Path) Parent() *Path
- func (p *Path) Path() string
- func (p *Path) ReadDir() ([]*Path, error)
- func (p *Path) ReadFile() ([]byte, error)
- func (p *Path) RelativeTo(other *Path) (*Path, error)
- func (p *Path) Remove() error
- func (p *Path) RemoveAll() error
- func (p *Path) Rename(newname string) error
- func (p *Path) RenamePath(target *Path) error
- func (p *Path) Resolve() (*Path, error)
- func (p *Path) SafeWriteReader(r io.Reader) error
- func (p *Path) Stat() (os.FileInfo, error)
- func (p *Path) Symlink(target *Path) error
- func (p *Path) Walk(walkFn filepath.WalkFunc) error
- func (p *Path) WriteFile(data []byte, perm os.FileMode) error
- func (p *Path) WriteReader(r io.Reader) error
Constants ¶
This section is empty.
Variables ¶
var (
ErrDoesNotImplement = errors.Errorf("doesn't implement required interface")
)
Functions ¶
This section is empty.
Types ¶
type Path ¶
type Path struct {
// DefaultFileMode is the mode that is used when creating new files in functions
// that do not accept os.FileMode as a parameter.
DefaultFileMode os.FileMode
// contains filtered or unexported fields
}
Path is an object that represents a path
func Glob ¶
Glob returns all of the path objects matched by the given pattern inside of the afero filesystem.
func NewPathAfero ¶
NewPathAfero returns a Path object with the given Afero object
func (*Path) Create ¶ added in v0.2.0
Create creates a file if possible, returning the file and an error, if any happens.
func (*Path) DirExists ¶ added in v0.2.0
DirExists returns whether or not the path represents a directory that exists
func (*Path) Equals ¶
Equals returns whether or not the path pointed to by other has the same resolved filepath as self.
func (*Path) FileContainsAnyBytes ¶ added in v0.2.0
FileContainsAnyBytes returns whether or not the path contains any of the listed bytes.
func (*Path) FileContainsBytes ¶ added in v0.2.0
FileContainsBytes returns whether or not the given file contains the bytes
func (*Path) GetLatest ¶
GetLatest returns the file or directory that has the most recent mtime. Only works if this path is a directory and it exists. If the directory is empty, the returned Path object will be nil.
func (*Path) IsAbsolute ¶
IsAbsolute returns whether or not the path is an absolute path. This is determined by checking if the path starts with a slash.
func (*Path) Join ¶
Join joins the current object's path with the given elements and returns the resulting Path object.
func (*Path) OpenFile ¶ added in v0.2.0
OpenFile opens a file using the given flags and the given mode.
func (*Path) ReadDir ¶
ReadDir reads the current path and returns a list of the corresponding Path objects.
func (*Path) ReadFile ¶
ReadFile reads the given path and returns the data. If the file doesn't exist or is a directory, an error is returned.
func (*Path) RelativeTo ¶
RelativeTo computes a relative version of path to the other path. For instance, if the object is /path/to/foo.txt and you provide /path/ as the argment, the returned Path object will represent to/foo.txt.
func (*Path) RenamePath ¶
RenamePath is the same as Rename except the argument is a Path object. The attributes of the path object is retained and does not inherit anything from target.
func (*Path) SafeWriteReader ¶ added in v0.2.0
SafeWriteReader is the same as WriteReader but checks to see if file/directory already exists.
func (*Path) Symlink ¶
Symlink symlinks to the target location. This will fail if the underlying afero filesystem does not implement afero.Linker.
func (*Path) Walk ¶ added in v0.2.0
Walk walks path, using the given filepath.WalkFunc to handle each