util

package
v0.0.0-...-ad90b1c Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VERSION = "0.5.5"
	COMMIT  = ""
)

Variables

This section is empty.

Functions

func Base64Decode

func Base64Decode(data string) ([]byte, error)

func Base64Encode

func Base64Encode(data []byte) string

func Base64Md5

func Base64Md5(data []byte) string

func Base64Md5ToBytes

func Base64Md5ToBytes(contentMd5 string) []byte

func BytesToUint16

func BytesToUint16(b []byte) (v uint16)

func BytesToUint32

func BytesToUint32(b []byte) (v uint32)

func BytesToUint64

func BytesToUint64(b []byte) (v uint64)

func CheckFile

func CheckFile(filename string) (exists, canRead, canWrite bool, modTime time.Time, fileSize int64)

func ConsistentIndex

func ConsistentIndex(s string, nodesCount int) int

func FileExists

func FileExists(filename string) bool

func GenerateRandomName

func GenerateRandomName(words int) string

func GenerateSecureToken

func GenerateSecureToken(length int) string

func GetFileSize

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

func HashStringToLong

func HashStringToLong(dir string) (v int64)

returns a 64 bit big int

func HashToInt32

func HashToInt32(data []byte) (v int32)

func Join

func Join(names ...string) string

func Md5

func Md5(data []byte) []byte

func Md5String

func Md5String(data []byte) string

func RandomBytes

func RandomBytes(byteCount int) []byte

func RandomInt32

func RandomInt32() int32

func ResolvePath

func ResolvePath(path string) string

func RunForever

func RunForever(fn func())

func TestDirWritable

func TestDirWritable(folder string) (err error)

func Uint16toBytes

func Uint16toBytes(b []byte, v uint16)

func Uint32toBytes

func Uint32toBytes(b []byte, v uint32)

func Uint64toBytes

func Uint64toBytes(b []byte, v uint64)

func Uint8toBytes

func Uint8toBytes(b []byte, v uint8)

func Version

func Version() string

Types

type BytesReader

type BytesReader struct {
	Bytes []byte
	*bytes.Reader
}

func NewBytesReader

func NewBytesReader(b []byte) *BytesReader

type FullPath

type FullPath string

func JoinPath

func JoinPath(names ...string) FullPath

func NewFullPath

func NewFullPath(dir, name string) FullPath

func (FullPath) AsInode

func (fp FullPath) AsInode() uint64

func (FullPath) Child

func (fp FullPath) Child(name string) FullPath

func (FullPath) DirAndName

func (fp FullPath) DirAndName() (string, string)

func (FullPath) Name

func (fp FullPath) Name() string

func (FullPath) Split

func (fp FullPath) Split() []string

split, but skipping the root

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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