Documentation
¶
Overview ¶
Package targz contains methods to create and extract tar gz archives.
Usage (discarding potential errors):
targz.Compress("path/to/the/directory/to/compress", "my_archive.tar.gz") targz.Extract("my_archive.tar.gz", "directory/to/extract/to")
This creates an archive in ./my_archive.tar.gz with the folder "compress" (last in the path). And extracts the folder "compress" to "directory/to/extract/to/". The folder structure is created if it doesn't exist.
Package targz contains methods to create and extract tar gz archives.
Usage (discarding potential errors):
targz.Compress("path/to/the/directory/to/compress", "my_archive.tar.gz") targz.Extract("my_archive.tar.gz", "directory/to/extract/to")
This creates an archive in ./my_archive.tar.gz with the folder "compress" (last in the path). And extracts the folder "compress" to "directory/to/extract/to/". The folder structure is created if it doesn't exist.
Index ¶
- Constants
- func AND(a bool, b bool) bool
- func ActionLog(Header string, char rune)
- func ActionLogFail(Header string, char rune)
- func ActionLogOK(Header string, char rune)
- func Base64DecString(value string) string
- func Base64EncString(value string) string
- func BasicAuth(username, password string) string
- func BuildID(name string) (string, error)
- func CallApi(url string, method string, headers []Header, payload io.Reader, ...) ([]byte, bool, error)
- func CallClear()
- func CastStringToType(input_type string, value interface{}) interface{}
- func CheckValidUrl(host string) error
- func Clean(str string, replace string) string
- func CleanNameToKey(name string) string
- func Compress(inputFilePath, outputFilePath string) (err error)
- func Concat(sep string, strs ...string) string
- func CopyDir(source string, dest string) (err error)
- func CopyFile(src, dst string) (int64, error)
- func CopyMap(m map[string]interface{}) map[string]interface{}
- func DecryptString(value string) (string, error)
- func DirExists(path string) bool
- func DisplayName(value string) string
- func Divide(a, b int) int
- func DownloadFile(filepath string, url string) error
- func EncryptString(value string) (string, error)
- func Extract(inputFilePath, outputFilePath string) (err error)
- func ExtractPackageDef(inputFilePath string) (string, error)
- func FileExists(path string) bool
- func FormatResults(title string, data interface{}) error
- func FuncName(value string) string
- func GetDomainOrIP(url_str string) string
- func GetFileNameFromIndex(repo_path string, string_index string) (string, error)
- func GetPortInt(url_str string) int
- func GetPortString(url_str string) string
- func GzipBase64(data string) (string, error)
- func InsertString(orig []string, index int, value string) []string
- func IsNumber(s string) bool
- func LogVerbose(msg string)
- func MakeDir(filename string) error
- func Minus(a, b int) int
- func Multiply(a, b int) int
- func NA(value string) string
- func NOT(a bool) bool
- func OR(a bool, b bool) bool
- func Plus(a, b int) int
- func PrintFail(msg string)
- func PrintOK(msg string)
- func PrintlnFail(msg string)
- func PrintlnOK(msg string)
- func PrivVarName(value string) string
- func PubVarName(value string) string
- func ReadFile(sourceFile string) string
- func ReadFileToString(sourceFile string) (string, error)
- func RemoveURL(str string) string
- func SafeName(value string) string
- func SaveEmbeddedFile(cfg *embed.FS, origin, dirName string) error
- func SaveStringToFile(filename string, content string) error
- func StringContainsStringListItem(string_list string, str string) bool
- func UserHomeDir() string
- func ZipFolder(ZipFile string, zipFolder string)
- type Header
- type LogStreamer
Constants ¶
const PASS_PHRASE = "lj3kasgdfjhg25fcmf"
Variables ¶
This section is empty.
Functions ¶
func ActionLogFail ¶
func ActionLogOK ¶
func Base64DecString ¶
func Base64EncString ¶
func CallApi ¶
func CallApi(url string, method string, headers []Header, payload io.Reader, ignore_ssl bool) ([]byte, bool, error)
General function for making api requests
func CastStringToType ¶
func CastStringToType(input_type string, value interface{}) interface{}
func CheckValidUrl ¶
func CleanNameToKey ¶
func Compress ¶
Compress creates a archive from the folder inputFilePath points to in the file outputFilePath points to. Only adds the last directory in inputFilePath to the archive, not the whole path. It tries to create the directory structure outputFilePath contains if it doesn't exist. It returns potential errors to be checked or nil if everything works.
func DecryptString ¶
func DisplayName ¶
func EncryptString ¶
func Extract ¶
Extract extracts a archive from the file inputFilePath points to in the directory outputFilePath points to. It tries to create the directory structure outputFilePath contains if it doesn't exist. It returns potential errors to be checked or nil if everything works.
func ExtractPackageDef ¶
func FormatResults ¶
func GetFileNameFromIndex ¶
func GetPortInt ¶
func GetPortString ¶
func GzipBase64 ¶
func LogVerbose ¶
func LogVerbose(msg string)
func PrintlnFail ¶
func PrintlnFail(msg string)
func PrivVarName ¶
func PubVarName ¶
func ReadFileToString ¶
Reads a file to string
func SaveStringToFile ¶
Helper function to create a directly and save string
func UserHomeDir ¶
func UserHomeDir() string
Types ¶
type LogStreamer ¶
type LogStreamer struct {
// contains filtered or unexported fields
}
func (*LogStreamer) String ¶
func (l *LogStreamer) String() string