Documentation ¶
Overview ¶
package fileutils contains file manipulation functions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewChecker ¶ added in v0.2.0
func NewChecker() *checker
Types ¶
type Checker ¶ added in v0.2.0
type Checker interface { /* Tests the existence of a file or directory at a given path. Returns true if and only if the file or directory exists. */ Exists(path string) bool /* Filemode returns the os.FileMode of the file with the given path. If the file does not exist, returns an error with tag ErrFileNotFound. */ Filemode(path string) (os.FileMode, error) }
Checker is a helper interface for querying files and directories.
type Copier ¶ added in v0.2.0
type Copier interface { /* Copy copies a source file to a destination file. File contents are copied. File mode and permissions (as described in http://golang.org/pkg/os/#FileMode) are copied. Directories are copied, along with their contents. Copying a file or directory to itself succeeds but does not modify the filesystem. Symbolic links are not followed and are copied provided they refer to a file or directory being copied (otherwise a non-nil error is returned). The only exception is copying a symbolic link to itself, which always succeeds. */ Copy(destPath string, srcPath string) error }
Copier is a helper interface for copying files and/or directories.
type ErrorId ¶ added in v0.2.0
type ErrorId string
const ( ErrOpeningSourceDir ErrorId = "cannot open source directory" ErrCannotListSourceDir ErrorId = "cannot list source directory" ErrUnexpected ErrorId = "unexpected error" ErrCreatingTargetDir ErrorId = "cannot create target directory" ErrOpeningSourceFile ErrorId = "cannot open source file" ErrOpeningTargetFile ErrorId = "cannot open target file" ErrCopyingFile ErrorId = "file copy failed" ErrReadingSourceSymlink ErrorId = "cannot read symbolic link source" ErrWritingTargetSymlink ErrorId = "cannot write target symbolic link" ErrExternalSymlink ErrorId = "external symbolic link" )
const ErrFileNotFound ErrorId = "file not found"
Click to show internal directories.
Click to hide internal directories.