utils

package
v0.0.0-...-16a29c9 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromBin

func FromBin(g []byte, v interface{}) error

FromBin decodes from the binary format if the gob is nil, the struct is nil and the error also

func Hash

func Hash(s string) string

Hash returns the SHA-256 hash of a string

func Htoa

func Htoa(h []byte) string

Htoa convert a hex slice to a string

func HumanReadableSize

func HumanReadableSize(size int64) string

HumanReadableSize return sizes in human readable format (e.g., 1K 234M 2G) If the size is negative, it returns an empty string. Take an int64 return a string

func PathIsValid

func PathIsValid(path string) bool

PathIsValid checks if the given path is valid. It checks for the Linux max length for NAME_MAX < 255 bytes and PATH_MAX < 4096. It must not contain "..", "//" or a nil byte and not start with a ".".

func ToBin

func ToBin(v interface{}) (g []byte, err error)

ToBin encodes into binary format if the struct is nil, the gob is nil and the error also

Types

This section is empty.

Jump to

Keyboard shortcuts

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