util

package
v0.6.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirPath added in v0.6.0

func DirPath(p string) string

DirPath returns the directory portion of a path (similar to filepath.Dir but handles slash-separated paths).

func Sha256FileHex

func Sha256FileHex(path string) (string, error)

Sha256FileHex streams the file at path and returns the lowercase hexadecimal SHA-256.

func Sha256Hex

func Sha256Hex(b []byte) string

Sha256Hex returns the lowercase hexadecimal SHA-256 of the provided bytes.

func Sha256StringHex

func Sha256StringHex(s string) string

Sha256StringHex returns the lowercase hexadecimal SHA-256 of the provided string.

func SplitNonEmptyLines

func SplitNonEmptyLines(s string) []string

func TarDirectoryToWriter

func TarDirectoryToWriter(localDir string, targetPrefix string, w io.Writer) error

TarDirectoryToWriter walks localDir and writes a tar stream to w. Each entry path in the archive is prefixed with targetPrefix when non-empty and not ".". Extract with `tar -xpf - -C <dest>`.

func TarFilesToWriter

func TarFilesToWriter(localRoot string, files []string, w io.Writer) error

TarFilesToWriter writes a tar stream containing only the provided relative file paths from localRoot. - files must be relative to localRoot and use OS path separators. They will be normalized to forward slashes in the archive. - directories will be created implicitly for files; directory headers are included as needed. - symlinks are ignored; non-regular special files are skipped.

func Truncate

func Truncate(s string, max int) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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