Documentation ¶
Index ¶
- Constants
- Variables
- func CopyDir(ctx context.Context, srcDir, dstDir string) error
- func CopyFile(ctx context.Context, src, out string) error
- func EnsureDir(path string, perm fs.FileMode) error
- func ForceRename(oldPath, newPath string) error
- func ModeOf(path string) (fs.FileMode, error)
- func SizeOf(path string) (uint64, error)
Constants ¶
const ModeUserRW = 0600 // rw-------
const ModeUserRWX = 0700 // rwx------
const ModeUserRWXGroupRX = 0750 // rwxr-x---
Variables ¶
var ErrUnsupportedFileType = errors.New("unsupported file type")
ErrUnsupportedFileType is returned when attempting to copy a file type that's not supported.
var ErrValueOutOfRange = errors.New("value out of range")
Functions ¶
func CopyDir ¶ added in v0.6.16
CopyDir recursively copies a directory from 'srcDir' to 'dstDir', preserving soft links. All regular files will be hard copied. Note that file attributes are not preserved, so this should only be used when the folder contents are required in the original structure. This implementation is based on [1].
[1] https://github.com/moby/moby/blob/master/daemon/graphdriver/copy/copy.go
func CopyFile ¶ added in v0.6.16
CopyFile is a utility function for copying an 'io.Reader' to a new file created with the specified 'os.FileMode'.
func EnsureDir ¶ added in v0.6.11
EnsureDir verifies that the specified path exists, is a directory, and has the specified permission bits set.
func ForceRename ¶
Moves a file or directory from one path to a new path.
NOTE: This will overwrite any file or directory which already exists at the 'newPath' parameter.
Types ¶
This section is empty.