Documentation
¶
Index ¶
- func DirPath(p string) string
- func Sha256FileHex(path string) (string, error)
- func Sha256Hex(b []byte) string
- func Sha256StringHex(s string) string
- func ShellEscape(s string) string
- func SplitNonEmptyLines(s string) []string
- func TarDirectoryToWriter(localDir string, targetPrefix string, w io.Writer) error
- func TarFilesToWriter(localRoot string, files []string, w io.Writer) error
- func Truncate(s string, max int) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DirPath ¶ added in v0.6.0
DirPath returns the directory portion of a path (similar to filepath.Dir but handles slash-separated paths).
func Sha256FileHex ¶
Sha256FileHex streams the file at path and returns the lowercase hexadecimal SHA-256.
func Sha256StringHex ¶
Sha256StringHex returns the lowercase hexadecimal SHA-256 of the provided string.
func ShellEscape ¶
ShellEscape escapes a string for safe use in a shell script within single quotes. It replaces any single quotes with '\” (end quote, escaped quote, start quote). Usage: sh -c "echo '" + ShellEscape(userInput) + "'"
func SplitNonEmptyLines ¶
func TarDirectoryToWriter ¶
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 ¶
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.
Types ¶
This section is empty.