Documentation
¶
Overview ¶
Package filesystem contains utilities for working with filesystems.
Index ¶
- func CopyFileIfExists(fs afero.Fs, src, dst string) error
- func CopyFilesBetweenFs(fromFS, toFS afero.Fs) error
- func CopyFolder(fs afero.Fs, sourceDir, targetDir string) error
- func CreateSymlink(targetFS *afero.BasePathFs, targetPath string, sourceFS *afero.BasePathFs, ...) error
- func FSToTar(f afero.Fs, prefix string, opts ...FSToTarOption) ([]byte, error)
- func FindNestedFoldersWithPattern(fs afero.Fs, root string, pattern string) ([]string, error)
- func FullPath(fs afero.Fs, path string) string
- func MemOverlay(fs afero.Fs) afero.Fs
- func Walk(fs afero.Fs, root string, walkFn filepath.WalkFunc) error
- type FSToTarOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyFileIfExists ¶
CopyFileIfExists copies a file from src to dst if the src file exists.
func CopyFilesBetweenFs ¶
CopyFilesBetweenFs copies all files from the source filesystem (fromFS) to the destination filesystem (toFS).
func CopyFolder ¶
CopyFolder recursively copies directory and all its contents from sourceDir to targetDir.
func CreateSymlink ¶
func CreateSymlink(targetFS *afero.BasePathFs, targetPath string, sourceFS *afero.BasePathFs, sourcePath string) error
CreateSymlink creates a symlink in a BasePathFs, potentially to another BasePathFs that shares the same underlying filesystem.
func FindNestedFoldersWithPattern ¶
FindNestedFoldersWithPattern finds nested folders containing files that match a specified pattern.
func FullPath ¶
FullPath returns the full path to path within the given filesystem. If fs is not an afero.BasePathFs the original path is returned.
func MemOverlay ¶
MemOverlay returns a filesystem that uses the given filesystem as a base layer but writes changes to an in-memory overlay filesystem.
Types ¶
type FSToTarOption ¶
type FSToTarOption func(*fsToTarConfig)
FSToTarOption configures the behavior of FSToTar.
func WithExcludePrefix ¶
func WithExcludePrefix(prefix string) FSToTarOption
WithExcludePrefix excludes files with the given prefix from the tar archive.
func WithGIDOverride ¶
func WithGIDOverride(gid int) FSToTarOption
WithGIDOverride sets the owner GID to use in the tar archive.
func WithSymlinkBasePath ¶
func WithSymlinkBasePath(bp string) FSToTarOption
WithSymlinkBasePath provides the real base path of the filesystem, for use in symlink resolution.
func WithUIDOverride ¶
func WithUIDOverride(uid int) FSToTarOption
WithUIDOverride sets the owner UID to use in the tar archive.