utils

package
v1.5.7 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists(fpath string) bool

Exists returns true if a file exists

func FileSize

func FileSize(fpath string) int64

FileSize return file size, return -1 if error

func IsDir

func IsDir(fpath string) bool

IsDir ...

func IsRegular

func IsRegular(fpath string) bool

IsRegular ...

func ReadyDir

func ReadyDir(filename string) error

ReadyDir ...

func SaveFile

func SaveFile(filename string, data []byte) error

SaveFile ...

Types

type FLock

type FLock struct {
	// contains filtered or unexported fields
}

FLock is a file-based lock

func NewFLock

func NewFLock(path string) (FLock, error)

NewFLock creates new Flock-based lock (unlocked first)

func (FLock) Lock

func (lock FLock) Lock() error

Lock acquires the lock, blocking

func (FLock) TryLock

func (lock FLock) TryLock() (bool, error)

TryLock acquires the lock, non-blocking

func (FLock) Unlock

func (lock FLock) Unlock() error

Unlock releases the lock

Jump to

Keyboard shortcuts

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