Documentation
¶
Index ¶
- type Path
- func (p Path) Age(now time.Time) (time.Duration, error)
- func (p Path) Exists() bool
- func (p Path) Glob(pattern string) ([]Path, error)
- func (p Path) IsDir() bool
- func (p Path) IsFile() bool
- func (p Path) JoinPath(paths ...Path) Path
- func (p Path) Mkdir() error
- func (p Path) Name() string
- func (p Path) Open(mode string) (*os.File, error)
- func (p Path) OpenWithPermissions(mode string, perms os.FileMode) (*os.File, error)
- func (p Path) Parent() Path
- func (p Path) Permissions() (os.FileMode, error)
- func (p Path) ReadBytes() ([]byte, error)
- func (p Path) RelativeTo(base Path) (Path, error)
- func (p Path) Rename(target Path) error
- func (p Path) Resolve() (Path, error)
- func (p Path) Rmdir() error
- func (p Path) RmdirRecursive() error
- func (p Path) Touch() error
- func (p Path) Unlink() error
- func (p Path) WithSuffix(suffix string) Path
- func (p Path) WriteBytes(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Path ¶
type Path string
Path type alias
func (Path) IsDir ¶
IsDir returns true if the Path is a directory. Note that false is returned if the Path does not exist.
func (Path) IsFile ¶
IsFile returns true if the Path is a file. Note that false is returned if the Path does not exist.
func (Path) JoinPath ¶
JoinPath returns any number of Paths joined by the OS specific path separator (eg. / or \).
func (Path) Mkdir ¶
Mkdir creates the directory Path, including any parent directories that need to be created along the way.
func (Path) Open ¶
Open opens the Path with the specified mode with 0755 permissions. If the Path does not exist, it creates it.
func (Path) OpenWithPermissions ¶
OpenWithPermissions opens the Path with the specified mode and permissions. If the Path does not exist, it creates it.
func (Path) Parent ¶
Parent returns the last directory in the Path. For a file, it returns the directory that the file is in. For a directory, it just returns the directory, not the directory above it.
func (Path) Permissions ¶
Permissions returns the Path's permissions as from os.Stat().
func (Path) RelativeTo ¶ added in v0.1.2
RelativeTo returns how this path is relative to the input Path, if at all.
func (Path) Rmdir ¶
Rmdir removes a directory, but will return an error if there are items within that directory (see RmdirRecursive).
func (Path) RmdirRecursive ¶
RmdirRecursive removes a directory and all items within it.
func (Path) Unlink ¶
Unlink removes a file Path, but will return an error if the Path is a directory (see Rmdir).
func (Path) WithSuffix ¶
WithSuffix returns a new Path with the specified suffix (file extension). If the Path has no existing extension, the new extension will be added. If the Path has an extension, it will be replaced.
func (Path) WriteBytes ¶
WriteBytes writes the bytes to the Path.