utils

package
v0.0.0-...-2e44025 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSyncTxtNotEnable = errors.New("sync txt is not enable")

Functions

func ByteSliceToString

func ByteSliceToString(bs []byte) string

func Contains

func Contains(alreadySyncFiles []string, f string) bool

func CreateDirIfNotExist

func CreateDirIfNotExist(path string) error

不存在目录就创建

func Exists

func Exists(path string) (bool, error)

检查路径是否存在

func GetEmbedBinName

func GetEmbedBinName(name string) string

func GetUploadFilePath

func GetUploadFilePath(basePath string, defaultRegexp []*regexp.Regexp) ([]string, error)

获取目录文件夹下的所有文件路径名

func Slash

func Slash(path string) string

func SplitSeparator

func SplitSeparator(path string) []string

func StringToByteSlice

func StringToByteSlice(str string) []byte

func TouchFile

func TouchFile(path string) error

创建空文件

Types

type SyncTxt

type SyncTxt struct {
	Enable   bool
	FileName string
	// contains filtered or unexported fields
}

func NewSyncTxt

func NewSyncTxt(fileName string, enable bool) (sync *SyncTxt, err error)

func (*SyncTxt) Close

func (s *SyncTxt) Close() error

impl Closer

func (*SyncTxt) UnSync

func (s *SyncTxt) UnSync(files []string) []string

func (*SyncTxt) Write

func (s *SyncTxt) Write(b []byte) (n int, err error)

impl Writer

func (*SyncTxt) WriteString

func (s *SyncTxt) WriteString(str string) (n int, err error)

impl StringWriter

Jump to

Keyboard shortcuts

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