lib

package
v0.0.0-...-89e69cd Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: Apache-2.0 Imports: 36 Imported by: 0

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

View Source
const PASS_PHRASE = "lj3kasgdfjhg25fcmf"

Variables

This section is empty.

Functions

func AND

func AND(a bool, b bool) bool

func ActionLog

func ActionLog(Header string, char rune)

func ActionLogFail

func ActionLogFail(Header string, char rune)

func ActionLogOK

func ActionLogOK(Header string, char rune)

func Base64DecString

func Base64DecString(value string) string

func Base64EncString

func Base64EncString(value string) string

func BasicAuth

func BasicAuth(username, password string) string

func BuildID

func BuildID(name string) (string, error)

Function to build name id

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 CallClear

func CallClear()

func CastStringToType

func CastStringToType(input_type string, value interface{}) interface{}

func CheckValidUrl

func CheckValidUrl(host string) error

func Clean

func Clean(str string, replace string) string

func CleanNameToKey

func CleanNameToKey(name string) string

func Compress

func Compress(inputFilePath, outputFilePath string) (err error)

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 Concat

func Concat(sep string, strs ...string) string

func CopyDir

func CopyDir(source string, dest string) (err error)

func CopyFile

func CopyFile(src, dst string) (int64, error)

Copy file

func CopyMap

func CopyMap(m map[string]interface{}) map[string]interface{}

func DecryptString

func DecryptString(value string) (string, error)

func DirExists

func DirExists(path string) bool

func DisplayName

func DisplayName(value string) string

func Divide

func Divide(a, b int) int

func DownloadFile

func DownloadFile(filepath string, url string) error

download file from url

func EncryptString

func EncryptString(value string) (string, error)

func Extract

func Extract(inputFilePath, outputFilePath string) (err error)

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 ExtractPackageDef(inputFilePath string) (string, error)

func FileExists

func FileExists(path string) bool

file exists

func FormatResults

func FormatResults(title string, data interface{}) error

func FuncName

func FuncName(value string) string

func GetDomainOrIP

func GetDomainOrIP(url_str string) string

strip the schema from url

func GetFileNameFromIndex

func GetFileNameFromIndex(repo_path string, string_index string) (string, error)

func GetPortInt

func GetPortInt(url_str string) int

func GetPortString

func GetPortString(url_str string) string

func GzipBase64

func GzipBase64(data string) (string, error)

func InsertString

func InsertString(orig []string, index int, value string) []string

func IsNumber

func IsNumber(s string) bool

func LogVerbose

func LogVerbose(msg string)

func MakeDir

func MakeDir(filename string) error

func Minus

func Minus(a, b int) int

func Multiply

func Multiply(a, b int) int

func NA

func NA(value string) string

func NOT

func NOT(a bool) bool

func OR

func OR(a bool, b bool) bool

func Plus

func Plus(a, b int) int

func PrintFail

func PrintFail(msg string)

func PrintOK

func PrintOK(msg string)

func PrintlnFail

func PrintlnFail(msg string)

func PrintlnOK

func PrintlnOK(msg string)

func PrivVarName

func PrivVarName(value string) string

func PubVarName

func PubVarName(value string) string

func ReadFile

func ReadFile(sourceFile string) string

read file to string

func ReadFileToString

func ReadFileToString(sourceFile string) (string, error)

Reads a file to string

func RemoveURL

func RemoveURL(str string) string

func SafeName

func SafeName(value string) string

special chars replaced with _

func SaveEmbeddedFile

func SaveEmbeddedFile(cfg *embed.FS, origin, dirName string) error

func SaveStringToFile

func SaveStringToFile(filename string, content string) error

Helper function to create a directly and save string

func StringContainsStringListItem

func StringContainsStringListItem(string_list string, str string) bool

func UserHomeDir

func UserHomeDir() string

func ZipFolder

func ZipFolder(ZipFile string, zipFolder string)

zip the folder

Types

type Header struct {
	Key   string `yaml:"key"`
	Value string `yaml:"value"`
}

Headers struct for the CallApi function

type LogStreamer

type LogStreamer struct {
	// contains filtered or unexported fields
}

func (*LogStreamer) String

func (l *LogStreamer) String() string

func (*LogStreamer) Write

func (l *LogStreamer) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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