Documentation ¶
Overview ¶
Package umaskfree provides file system functionality that ignore the umask. As such it is not safe to use otherwise equivalent functions provided by the standard go library concurrently with this package. Users should take care that no other code in their application uses these functions.
Index ¶
- Constants
- Variables
- func CopyDirectory(ctx context.Context, dst, src string, onCopy func(dst, src string)) error
- func CopyFile(ctx context.Context, dst, src string) error
- func CopyLink(ctx context.Context, dst, src string) error
- func Create(path string, mode fs.FileMode) (*os.File, error)
- func Mkdir(path string, mode fs.FileMode) error
- func MkdirAll(path string, mode fs.FileMode) error
- func Touch(path string, perm fs.FileMode) error
- func WriteFile(path string, data []byte, mode fs.FileMode) error
Constants ¶
DefaultDirPerm should be used by callers to use a consistent mode for new directories.
const DefaultFilePerm fs.FileMode = 0666
DefaultFilePerm should be used by callers to use a consistent file mode for new files.
Variables ¶
var ErrCopySameFile = errors.New("src and dst must be different")
var ErrDstFile = errors.New("dst is a file")
Functions ¶
func CopyDirectory ¶
CopyDirectory copies the directory src to dst recursively. Copying is aborted when ctx is closed.
Existing files and directories are overwritten. When a directory already exists, additional files are not deleted.
onCopy, when not nil, is called for each file or directory being copied.
func CopyFile ¶
CopyFile copies a file from src to dst. When src points to a symbolic link, will copy the symbolic link.
When dst and src are the same file, returns ErrCopySameFile. When ctx is closed, the file is not copied.
func CopyLink ¶
CopyLink copies a link from src to dst. If dst already exists, it is deleted and then re-created.
Types ¶
This section is empty.