Documentation ¶
Index ¶
- Constants
- func DeleteFile(path string) error
- func GetFreeSpace(path string) (unit.Bytes, error)
- func GetTotalAndFreeSpace(path string) (unit.Bytes, unit.Bytes, error)
- func GetTotalSpace(path string) (unit.Bytes, error)
- func GetUsedSpace(path string) (unit.Bytes, error)
- func IsDir(path string) bool
- func IsEmptyDir(path string) (bool, error)
- func IsRegular(path string) bool
- func IsSymbolicLink(name string) bool
- func Link(oldname string, newname string) error
- func MkdirAll(dir string) error
- func MoveFile(src string, dst string) error
- func OpenFile(path string, flag int, perm os.FileMode) (*os.File, error)
- func PathExist(path string) bool
- func SymbolicLink(oldname string, newname string) error
- type FileLock
Constants ¶
const ( // PrivateFileMode grants owner to read/write a file. PrivateFileMode = 0600 // PrivateDirMode means read and execute access for everyone and also write access for the owner of the directory. PrivateDirMode = 0755 )
Variables ¶
This section is empty.
Functions ¶
func DeleteFile ¶
DeleteFile deletes a regular file not a directory.
func GetFreeSpace ¶
GetFreeSpace gets the free disk space of the path.
func Link ¶
Link creates a hard link pointing to oldname named newname for a file.
func MkdirAll ¶
MkdirAll creates a directory named path with 0755 perm.
func OpenFile ¶
OpenFile opens a file. If the parent directory of the file isn't exist, it will create the directory with 0755 perm.
func PathExist ¶
PathExist reports whether the path is exist. Any error, from os.Lstat, will return false.
Types ¶
type FileLock ¶
type FileLock struct {
// contains filtered or unexported fields
}
FileLock defines a file lock implemented by syscall.Flock. Locks created by flock() are associated with an open file description. This means that duplicate file descriptors (created by, for example, fork or dup) refer to the same lock, and this lock may be modified or released using any of these file descriptors. Furthermore, the lock is released either by an explicit LOCK_UN operation on any of these duplicate file descriptors, or when all such file descriptors have been closed.