Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler interface {
// Copy file from source to destination by chunks of 32KB.
Copy(srcPath, dstPath string, targetPerm os.FileMode) error
// Delete deletes file. If there is an error, it will be of types *os.PathError.
Delete(filepath string) error
// Checksum validates a file from given path.
// Returns error only if it cannot read or locate the file, or the checksum failed.
Checksum(filepath string, checksum string) error
// Fetch will retrieve file from given uri
Fetch(uri string, filepath string) error
// FetchAndCheck calls Fetch to retrieve file, while checking the checksum to validate incoming file.
// The file will be deleted if checksum fails.
FetchAndCheck(uri string, filepath string, checksum string) error
// Write writes byte array content to given filepath and permission.
Write(filepath string, content []byte, perm os.FileMode) error
// Read reads byte array content from given filepath. This works as identical delegation to os.ReadFile.
Read(filepath string) ([]byte, error)
// Exists checks filepath to see if exists
Exists(filepath string) (bool, error)
}
func NewHandler ¶
func NewHandler() Handler
Click to show internal directories.
Click to hide internal directories.