Documentation ¶
Index ¶
- func DirExists(name string) (exists bool, err error)
- func FileExists(name string) (exists bool, err error)
- func NotExpired(name string, ttl time.Duration) error
- func PathExists(name string) (exists bool, err error)
- func TryStat(name string) (stat os.FileInfo, err error)
- func ValidateExistsFile(name string) (err error)
- func ValidateFile(name string, hash hash.Hash, expected []byte) error
- func ValidateFileHex(name string, hash hash.Hash, expected string) error
- type FileExpiredError
- type HashMatchError
- type InvalidHashSumError
- type StatErr
- type ValidateError
- type WrongPathType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DirExists ¶
DirExists uses TryStat function to check if the directory exists at location.
If stat fails with error related to directory absence, it does not return that error, only false boolean; in any other case both false and the error are returned.
If stat succeeds, only true boolean is returned.
func FileExists ¶
FileExists uses TryStat function to check if the file exists at location.
If stat fails with error related to file absence, it does not return that error, only false boolean; in any other case both false and the error are returned.
If stat succeeds, only true boolean is returned.
func PathExists ¶
PathExists uses TryStat function to check if the file or directory exists at location.
If stat fails with error related to file or directory absence, it does not return that error, only false boolean; in any other case both false and the error are returned.
If stat succeeds, only true boolean is returned.
func ValidateExistsFile ¶
Types ¶
type FileExpiredError ¶
func (*FileExpiredError) Error ¶
func (e *FileExpiredError) Error() string
func (*FileExpiredError) Is ¶
func (e *FileExpiredError) Is(target error) bool
type HashMatchError ¶
func (*HashMatchError) Error ¶
func (h *HashMatchError) Error() string
func (*HashMatchError) Is ¶
func (h *HashMatchError) Is(target error) bool
type InvalidHashSumError ¶
func (*InvalidHashSumError) Error ¶
func (i *InvalidHashSumError) Error() string
func (*InvalidHashSumError) Is ¶
func (i *InvalidHashSumError) Is(target error) bool
func (*InvalidHashSumError) Unwrap ¶
func (i *InvalidHashSumError) Unwrap() error
type StatErr ¶
func (*StatErr) DoesNotExist ¶
DoesNotExist returns whether the error is related to file being absent rather than any other reason.
type ValidateError ¶
func (*ValidateError) Error ¶
func (v *ValidateError) Error() string
func (*ValidateError) Is ¶
func (v *ValidateError) Is(target error) bool
func (*ValidateError) Mismatch ¶
func (v *ValidateError) Mismatch() bool
Mismatch returns whether the error is just about mismatch. This value will be true if file does not exist, or if it does, but hash does not match. In any other case, the value is false.
func (*ValidateError) Unwrap ¶
func (v *ValidateError) Unwrap() error
type WrongPathType ¶
func (*WrongPathType) Error ¶
func (f *WrongPathType) Error() string
func (*WrongPathType) Is ¶
func (f *WrongPathType) Is(target error) bool