helper

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPathDoesNotExist = errors.New("path does not exist")

ErrPathDoesNotExist is raised if the requested path does not exist

View Source
var ErrPathIsNotDir = errors.New("path is not a directory")

ErrPathIsNotDir is raised if the requested path is not a directory

Functions

func ByteCountSI

func ByteCountSI(b int64) string

ByteCountSI converts bytes to a human-readable format

func Check

func Check(err error)

Check panics if err is not nil

func CheckIgnoreTimeout added in v1.8.1

func CheckIgnoreTimeout(err error)

CheckIgnoreTimeout panics if err is not nil and not a timeout

func CreateDir

func CreateDir(name string)

CreateDir creates the data folder if it does not exist

func FileExists

func FileExists(filename string) bool

FileExists returns true if a file exists

func FolderExists

func FolderExists(folder string) bool

FolderExists returns true if a folder exists

func GenerateRandomString

func GenerateRandomString(length int) string

GenerateRandomString returns a URL-safe, base64 encoded securely generated random string.

func GetFileSize

func GetFileSize(file *os.File) (int64, error)

GetFileSize returns the file size in bytes

func IsInArray

func IsInArray(haystack []string, needle string) bool

IsInArray returns true if value is in array

func ReadLine

func ReadLine() string

ReadLine reads a line from the terminal and returns it as a string

func ReadPassword

func ReadPassword() string

ReadPassword reads a line without displaying input from the terminal and returns it as a string

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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