util

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2023 License: GPL-3.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

View Source
const FileSchema = "FILE"

Variables

This section is empty.

Functions

func ByteFmt

func ByteFmt(size int64) string

func CheckDuplicateAndRename

func CheckDuplicateAndRename(path string) (string, error)

CheckDuplicateAndRename rename duplicate file, add suffix (1) (2) ... if file name is a.txt, rename to a (1).txt if directory name is a, rename to a (1) return new name

func Dir

func Dir(path string) string

func Filepath

func Filepath(path string, originName string, customName string) string

func GetSingleDir

func GetSingleDir(paths []string) string

GetSingleDir get the top level single folder name,if not exist, return empty string

func MapToStruct

func MapToStruct(s any, v any) error

func ParseSchema

func ParseSchema(url string) string

func SafeRemove

func SafeRemove(name string) error

SafeRemove remove file safely, ignoring errors if the path does not exist.

Types

type Timer

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

计时器

func (*Timer) Pause

func (t *Timer) Pause()

func (*Timer) Start

func (t *Timer) Start()

func (*Timer) Used

func (t *Timer) Used() int64

Jump to

Keyboard shortcuts

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