Documentation ¶
Overview ¶
Package fs implements an OS independent abstraction of a file system suitable for backup purposes.
Index ¶
- func Chmod(name string, mode os.FileMode) error
- func Create(name string) (*os.File, error)
- func DeviceID(fi os.FileInfo) (deviceID uint64, err error)
- func Link(oldname, newname string) error
- func Lstat(name string) (os.FileInfo, error)
- func Mkdir(name string, perm os.FileMode) error
- func MkdirAll(path string, perm os.FileMode) error
- func OpenFile(name string, flag int, perm os.FileMode) (*os.File, error)
- func Readlink(name string) (string, error)
- func Remove(name string) error
- func RemoveAll(path string) error
- func RemoveIfExists(filename string) error
- func Rename(oldpath, newpath string) error
- func Stat(name string) (os.FileInfo, error)
- func Symlink(oldname, newname string) error
- func TempFile(dir, prefix string) (f *os.File, err error)
- func Walk(root string, walkFn filepath.WalkFunc) error
- type File
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶ added in v0.3.0
Create creates the named file with mode 0666 (before umask), truncating it if it already exists. If successful, methods on the returned File can be used for I/O; the associated file descriptor has mode O_RDWR. If there is an error, it will be of type *PathError.
func DeviceID ¶ added in v0.3.0
DeviceID extracts the device ID from an os.FileInfo object by casting it to syscall.Stat_t
func Link ¶ added in v0.5.0
Link creates newname as a hard link to oldname. If there is an error, it will be of type *LinkError.
func Lstat ¶ added in v0.3.0
Lstat returns the FileInfo structure describing the named file. If the file is a symbolic link, the returned FileInfo describes the symbolic link. Lstat makes no attempt to follow the link. If there is an error, it will be of type *PathError.
func Mkdir ¶ added in v0.3.0
Mkdir creates a new directory with the specified name and permission bits. If there is an error, it will be of type *PathError.
func MkdirAll ¶ added in v0.3.0
MkdirAll creates a directory named path, along with any necessary parents, and returns nil, or else returns an error. The permission bits perm are used for all directories that MkdirAll creates. If path is already a directory, MkdirAll does nothing and returns nil.
func OpenFile ¶ added in v0.3.0
OpenFile is the generalized open call; most users will use Open or Create instead. It opens the named file with specified flag (O_RDONLY etc.) and perm, (0666 etc.) if applicable. If successful, methods on the returned File can be used for I/O. If there is an error, it will be of type *PathError.
func Readlink ¶ added in v0.3.0
Readlink returns the destination of the named symbolic link. If there is an error, it will be of type *PathError.
func Remove ¶ added in v0.3.0
Remove removes the named file or directory. If there is an error, it will be of type *PathError.
func RemoveAll ¶ added in v0.3.0
RemoveAll removes path and any children it contains. It removes everything it can but returns the first error it encounters. If the path does not exist, RemoveAll returns nil (no error).
func RemoveIfExists ¶ added in v0.6.0
RemoveIfExists removes a file, returning no error if it does not exist.
func Rename ¶ added in v0.3.0
Rename renames (moves) oldpath to newpath. If newpath already exists, Rename replaces it. OS-specific restrictions may apply when oldpath and newpath are in different directories. If there is an error, it will be of type *LinkError.
func Stat ¶ added in v0.3.0
Stat returns a FileInfo structure describing the named file. If there is an error, it will be of type *PathError.
func Symlink ¶ added in v0.3.0
Symlink creates newname as a symbolic link to oldname. If there is an error, it will be of type *LinkError.
func TempFile ¶ added in v0.6.0
TempFile creates a temporary file which has already been deleted (on supported platforms)
func Walk ¶ added in v0.3.0
Walk walks the file tree rooted at root, calling walkFn for each file or directory in the tree, including root. All errors that arise visiting files and directories are filtered by walkFn. The files are walked in lexical order, which makes the output deterministic but means that for very large directories Walk can be inefficient. Walk does not follow symbolic links.