Documentation
¶
Overview ¶
Package utils provides utility functions for file operations.
Index ¶
- func CalculateMD5(path string) (checksum string, err error)
- func CalculateSHA256(path string) (checksum string, err error)
- func CreateBackup(path string) (backupPath string, err error)
- func MergeVariables(base, override map[string]interface{}) map[string]interface{}
- func VerifyChecksum(path, expected string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateMD5 ¶
CalculateMD5 calculates the MD5 checksum of a file. Note: MD5 is deprecated for security purposes but still commonly used for integrity checks.
func CalculateSHA256 ¶
CalculateSHA256 calculates the SHA256 checksum of a file.
func CreateBackup ¶
CreateBackup creates a timestamped backup of a file. Returns the backup path and any error encountered.
func MergeVariables ¶
MergeVariables merges two variable maps, with override taking precedence. Returns a new map containing all keys from both maps. When a key exists in both maps, the value from override is used.
func VerifyChecksum ¶
VerifyChecksum verifies a file's checksum against an expected value. Supports both SHA256 and MD5 based on the length of the expected checksum.
Types ¶
This section is empty.