Documentation
¶
Overview ¶
Package util provides common helper functions for file operations, HTTP, and encoding.
Index ¶
- func DecodeBase64Content(content string) ([]byte, error)
- func DecodeContent(content string, encoding string) ([]byte, error)
- func DecodeGzipContent(content string) ([]byte, error)
- func DecompressGzip(content []byte) ([]byte, error)
- func EnsureDirectoryExists(dir string) error
- func ExistsAndExecutable(path string) bool
- func HTTPDownloadToFile(url, dest string) error
- func HTTPLoadBytes(url string) ([]byte, error)
- func MaskPassword(r *os.File, w io.Writer) ([]byte, error)
- func PromptPassword() (string, bool, error)
- func RunScript(path string, arg ...string) error
- func WriteFileAtomic(filename string, data []byte, perm os.FileMode) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeBase64Content ¶
DecodeBase64Content decodes a base64-encoded string and returns the raw bytes.
func DecodeContent ¶
DecodeContent decodes content based on the specified encoding (base64, gzip, or combined).
func DecodeGzipContent ¶
DecodeGzipContent decompresses a gzip-encoded string and returns the raw bytes.
func DecompressGzip ¶
DecompressGzip decompresses gzip-compressed bytes and returns the result.
func EnsureDirectoryExists ¶
EnsureDirectoryExists creates the directory if it does not exist, or returns an error if the path is not a directory.
func ExistsAndExecutable ¶
ExistsAndExecutable returns true if the path exists and has executable permissions.
func HTTPDownloadToFile ¶
HTTPDownloadToFile downloads a URL and writes the response body to a file atomically.
func HTTPLoadBytes ¶
HTTPLoadBytes fetches a URL and returns the response body as bytes.
func MaskPassword ¶
MaskPassword reads a password from the given file, masking input with asterisks.
func PromptPassword ¶
PromptPassword prompts for a password with confirmation, returning the password and whether they match.
Types ¶
This section is empty.