Documentation
¶
Overview ¶
Package fileutil provides shared file-transfer utilities for invoke providers.
This package is intended to be used by provider implementations to avoid duplicating common patterns like progress reporting, context cancellation checking, and path traversal validation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPathTraversal ¶
CheckPathTraversal validates that target is a child of root using local filesystem path conventions (filepath.Abs, os.PathSeparator). Returns an error if target escapes the root directory (ZipSlip protection).
func CheckRemotePathTraversal ¶
CheckRemotePathTraversal validates that target is a child of root using forward-slash path conventions (path.Clean, "/"). Use this for remote Unix-like paths where filepath operations would use the wrong separator on Windows hosts.
Types ¶
type ContextReader ¶
ContextReader wraps an io.Reader to check for context cancellation before each Read call. This allows long-running io.Copy operations to be interrupted by context cancellation.
type ProgressReader ¶
ProgressReader wraps an io.Reader to report progress via an invoke.ProgressFunc. Total should be set to the known total size for percentage-based progress reporting, or 0 if unknown.