fileutil

package
v0.16.5 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package fileutil provides shared helpers for computing and comparing file checksums, used by resources that detect drift in a file referenced by path (e.g. package archives, investigation guide content).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileChecksumDrifted

func FileChecksumDrifted(path string, priorChecksum string, hasPriorState bool) (newChecksum string, changed bool, err error)

FileChecksumDrifted computes the current SHA-256 digest of the file at path and reports whether it differs from priorChecksum. hasPriorState must be false when the resource is being created (there is no prior state to compare against); in that case changed is true when the digest is computed successfully. Otherwise, changed reports whether newChecksum != priorChecksum.

func SHA256HexDigest

func SHA256HexDigest(path string) (string, error)

SHA256HexDigest returns the hex-encoded SHA-256 digest of the file at path. It streams the file contents rather than loading the whole file into memory, so it is safe to use on large files.

Types

This section is empty.

Jump to

Keyboard shortcuts

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