util

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayContains

func ArrayContains[R comparable](a []R, v R) bool

ArrayContains checks if array a[] contains value v or not

func CloseSilently

func CloseSilently(ctx context.Context, close func() error)

CloseSilently closes and write log if an error occurs

func EnsureDirExist

func EnsureDirExist(ctx context.Context, dir string) error

EnsureDirExist creates a directory if it is not existed

func SanitizePath

func SanitizePath(ctx context.Context, d, t string) (v string, err error)

SanitizePath is to void "G305: Zip Slip vulnerability"

func ToArrayString

func ToArrayString(a []interface{}) ([]string, bool)

ToArrayString converts from array of interface{} to array of string

func ToString

func ToString(any interface{}) string

ToString converts anything to string

func Unzip

func Unzip(ctx context.Context, inputPath string, outputDir string) error

Unzip decompress a file into an output directory

func WriteToFile

func WriteToFile(ctx context.Context, reader io.Reader, path string) error

WriteToFile writes to file

Types

This section is empty.

Jump to

Keyboard shortcuts

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