Documentation
¶
Index ¶
- Variables
- func AddFileToZip(zipData []byte, filename string, content []byte) ([]byte, error)
- func CompareZipContents(zipData1, zipData2 []byte) (bool, error)
- func ComputeFileSHA256(filePath string) (string, error)
- func ComputeFileSHA512(filePath string) (string, error)
- func ComputeSHA256(data []byte) string
- func ComputeSHA512(data []byte) string
- func ComputeZipHash(zipData []byte) ([]byte, error)
- func CreateZip(sourceDir string) ([]byte, error)
- func EnsureDir(path string) error
- func ExpandTilde(path string) (string, error)
- func ExtractZip(zipData []byte, targetDir string) error
- func FileExists(path string) bool
- func GetClaudeDir() (string, error)
- func GetConfigDir() (string, error)
- func GetConfigFile() (string, error)
- func IsDirectory(path string) bool
- func IsZipFile(data []byte) bool
- func ListZipFiles(zipData []byte) ([]string, error)
- func NormalizePath(path string) (string, error)
- func ReadZipFile(zipData []byte, filename string) ([]byte, error)
- func RemoveFileFromZip(zipData []byte, filename string) ([]byte, error)
- func ReplaceFileInZip(zipData []byte, filename string, content []byte) ([]byte, error)
- func URLHash(url string) string
- func VerifyHash(data []byte, algorithm, expected string) error
Constants ¶
This section is empty.
Variables ¶
var ZipMagicBytes = []byte{0x50, 0x4B, 0x03, 0x04}
ZipMagicBytes are the first 4 bytes of a ZIP file
Functions ¶
func AddFileToZip ¶
AddFileToZip adds or updates a file in a zip archive
func CompareZipContents ¶
CompareZipContents compares two zip files by computing and comparing their hashes Excludes metadata.toml from comparison to focus on actual content
func ComputeFileSHA256 ¶
ComputeFileSHA256 computes the SHA256 hash of a file
func ComputeFileSHA512 ¶
ComputeFileSHA512 computes the SHA512 hash of a file
func ComputeSHA256 ¶
ComputeSHA256 computes the SHA256 hash of data
func ComputeSHA512 ¶
ComputeSHA512 computes the SHA512 hash of data
func ComputeZipHash ¶
ComputeZipHash computes an MD5 hash of all files in a zip archive Files are hashed individually, then combined in alphabetical order by filename
func ExpandTilde ¶
ExpandTilde expands a tilde (~) at the beginning of a path to the user's home directory
func ExtractZip ¶
ExtractZip extracts a zip file to a target directory
func GetClaudeDir ¶
GetClaudeDir returns the path to the .claude directory for asset installation This is where global assets are installed
func GetConfigDir ¶
GetConfigDir returns the path to the sx config directory Uses platform-specific config directories: - Linux: ~/.config/sx (or $XDG_CONFIG_HOME/sx) - macOS: ~/Library/Application Support/sx - Windows: %AppData%/sx
func GetConfigFile ¶
GetConfigFile returns the path to the config.json file
func ListZipFiles ¶
ListZipFiles returns a list of all files in a zip archive
func NormalizePath ¶
NormalizePath normalizes a file path, expanding tilde and cleaning it
func ReadZipFile ¶
ReadZipFile reads a specific file from a zip archive without extracting
func RemoveFileFromZip ¶
RemoveFileFromZip removes a file from a zip archive
func ReplaceFileInZip ¶
ReplaceFileInZip replaces an existing file in a zip archive This is an alias for AddFileToZip which already handles replacement
func VerifyHash ¶
VerifyHash verifies that data matches the expected hash
Types ¶
This section is empty.