Documentation
¶
Index ¶
- func CleanDir(path string) (retErr error)
- func InstallFile(filename string, r io.Reader, perm os.FileMode) error
- func IsDirEmpty(dir string) (bool, error)
- func IsExecutable(filePath string) bool
- func ProbeRemoteHTTPObject(ctx context.Context, source string) error
- func ProbeWritableDir(dir string) error
- func UpdateSymlink(linkPath, targetPath string) error
- func WriteFile(filename string, content []byte, perm os.FileMode) error
- type TarFile
- type TarFileSeq
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InstallFile ¶
InstallFile writes the content from the provided reader to a local file with specified permissions. It limits the size of the content to 1 GiB and returns an error if the limit is exceeded. It ensures that the target directory exists and handles the file writing atomically.
NOTE: we assume the filename is trusted and cleaned without path traversal characters.
func IsDirEmpty ¶
IsDirEmpty reports whether dir is empty or does not exist.
func IsExecutable ¶
func ProbeRemoteHTTPObject ¶ added in v0.1.20
ProbeRemoteHTTPObject checks that an HTTP artifact object is reachable without downloading the full object. It first tries HEAD, then falls back to a ranged GET for servers that do not support or incorrectly reject HEAD.
func ProbeWritableDir ¶ added in v0.1.20
ProbeWritableDir verifies that dir accepts file creation and removal without leaving durable state behind.
func UpdateSymlink ¶ added in v0.1.4
UpdateSymlink atomically updates linkPath to point at targetPath.
func WriteFile ¶
WriteFile writes the provided content to a local file with specified permissions. It ensures that the target directory exists and handles the file writing atomically. The temp file is created in the same directory as the destination to preserve the correct SELinux label (avoiding the user_tmp_t label from /tmp).
NOTE: we assume the filename is trusted and cleaned without path traversal characters.
Types ¶
type TarFileSeq ¶ added in v0.1.21
func DecompressTarGz ¶ added in v0.1.21
func DecompressTarGz(body io.Reader) TarFileSeq
DecompressTarGz returns an iterator that yields the files contained in a gzip-compressed tar stream.
func DecompressTarGzFromRemote ¶
func DecompressTarGzFromRemote(ctx context.Context, url string) TarFileSeq
DecompressTarGzFromRemote returns an iterator that yields the files contained in a .tar.gz file located at the given HTTP(S) URL.