utils

package
v0.0.0-...-b203053 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

archive-utils.go - Provides utility methods for handling archives

http-utils.go - Provides utility methods for HTTP handling

os-utils.go - Provide operating system IO related utility methods

I.E.) opening files, creating directories, remove files/directories, getting file info.

utils.go - Provide generic utility methods.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDir

func CreateDir(path string) error

func CreateFile

func CreateFile(fileName string) (*os.File, error)

func ExtractGZIP

func ExtractGZIP(gzFileName string, destination string) (string, error)

Extracts the gzip file represented by the file name and extracts the content to the provided destination

func GetFileContents

func GetFileContents(file string) (string, error)

func GetFilesByExtension

func GetFilesByExtension(root string, extensions []string) ([]string, error)

func IsStrInStrArray

func IsStrInStrArray(vals []string, strToCheck string) bool

Does the provided string exist in the provided slice of strings

func NewHttpRequestNoBody

func NewHttpRequestNoBody(httpMethod string, url string, headers *map[string]string) (*http.Request, error)

Create a new HTTP request that contains the provided headers, method and url. Request has no body

func OpenFile

func OpenFile(filepath string) (*os.File, error)

func PanicIfError

func PanicIfError(e error)

func RemoveDir

func RemoveDir(dir string) error

func RemoveDuplicate

func RemoveDuplicate[T comparable](sliceList []T) []T

func RemoveDuplicates

func RemoveDuplicates(tokens []string) []string

Remove any duplicate tokens for a slice of tokens

func RemoveFile

func RemoveFile(filePath string) error

func StringsMatch

func StringsMatch(lhs string, rhs string) bool

Do the strings match

Handles * wildcard strings as well as concrete strings

Types

This section is empty.

Jump to

Keyboard shortcuts

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