Documentation ¶
Overview ¶
Package ioutils implements helper functions used in github.com/minio/mc
Index ¶
Constants ¶
const ( Nanosecond Duration = 1 Microsecond = 1000 * Nanosecond Millisecond = 1000 * Microsecond Second = 1000 * Millisecond Minute = 60 * Second Hour = 60 * Minute Day = 24 * Hour )
Common durations. There is no definition for units of Day or larger to avoid confusion across daylight savings time zone transitions.
To count the number of units in a Duration, divide:
second := time.Second fmt.Print(int64(second/time.Millisecond)) // prints 1000
To convert an integer number of units to a Duration, multiply:
seconds := 10 fmt.Print(time.Duration(seconds)*time.Second) // prints 10s
Variables ¶
var ErrDirNotEmpty = errors.New("directory not empty")
ErrDirNotEmpty is used to throw error on directories which have atleast one regular file or a symlink left
var ErrSkipDir = errors.New("skip this directory")
ErrSkipDir is used as a return value from WalkFuncs to indicate that the directory named in the call is to be skipped. It is not returned as an error by any function.
var ErrSkipFile = errors.New("skip this file")
ErrSkipFile is used as a return value from WalkFuncs to indicate that the file named in the call is to be skipped. It is not returned as an error by any function.
Functions ¶
func FTW ¶
FTW walks the file tree rooted at root, calling walkFn for each file or directory in the tree, including root.
func IsDirEmpty ¶
IsDirEmpty Check if a directory is empty
func ParseDurationTime ¶
ParseDurationTime parses a duration string in the form "10d4h3m". A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h", "d". It add the days functionality to time.ParseDuration().
Types ¶
type Duration ¶
type Duration int64
A Duration represents the elapsed time between two instants as an int64 nanosecond count. The representation limits the largest representable duration to approximately 290 years.
type FTWFunc ¶
FTWFunc is the type of the function called for each file or directory visited by Walk. The path argument contains the argument to Walk as a prefix; that is, if Walk is called with "dir", which is a directory containing the file "a", the walk function will be called with argument "dir/a". The info argument is the os.FileInfo for the named path.