utils

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package utils provides utility functions for file operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateMD5

func CalculateMD5(path string) (checksum string, err error)

CalculateMD5 calculates the MD5 checksum of a file. Note: MD5 is deprecated for security purposes but still commonly used for integrity checks.

func CalculateSHA256

func CalculateSHA256(path string) (checksum string, err error)

CalculateSHA256 calculates the SHA256 checksum of a file.

func CreateBackup

func CreateBackup(path string) (backupPath string, err error)

CreateBackup creates a timestamped backup of a file. Returns the backup path and any error encountered.

func MergeVariables

func MergeVariables(base, override map[string]interface{}) map[string]interface{}

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

func VerifyChecksum(path, expected string) (bool, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL