const PrivateFileMode … // IsDirWriteable checks if dir is writable by writing and removing a file // to dir. It returns nil if dir is writable. func IsDirWriteable(dir string) error { … } // TouchDirAll is similar to os.MkdirAll. It creates directories with 0700 permission if any directory // does not exists. TouchDirAll also ensures the given directory is writable. func TouchDirAll(lg *zap.Logger, dir string) error { … } // CreateDirAll is similar to TouchDirAll but returns error // if the deepest directory was not empty. func CreateDirAll(lg *zap.Logger, dir string) error { … } // Exist returns true if a file or directory exists. func Exist(name string) bool { … } // DirEmpty returns true if a directory empty and can access. func DirEmpty(name string) bool { … } // ZeroToEnd zeros a file starting from SEEK_CUR to its SEEK_END. May temporarily // shorten the length of the file. func ZeroToEnd(f *os.File) error { … } // CheckDirPermission checks permission on an existing dir. // Returns error if dir is empty or exist with a different permission than specified. func CheckDirPermission(dir string, perm os.FileMode) error { … } // RemoveMatchFile deletes file if matchFunc is true on an existing dir // Returns error if the dir does not exist or remove file fail func RemoveMatchFile(lg *zap.Logger, dir string, matchFunc func(fileName string) bool) error { … }