fileutil

package
v0.0.0-...-c50a420 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CmdPath = ""
)

Functions

func CopyFile

func CopyFile(src, dst string) error

拷贝文件

func CreateDir

func CreateDir(basePath, folderName string) (string, error)

basePath是固定目录路径

func DirIsEmpty

func DirIsEmpty(dirname string) bool

文件夹是否为空

func FileExists

func FileExists(name string) bool

文件是否存在

func FindResourcePth

func FindResourcePth(fileName string, pathsarr ...string) string

从指定的目录里查找资源, 查找的目录包括$GOPATH, $GOPATH/src/resources, $GOPATH/resources, appPath, workPath/docs, /opt/goproject等

func IsUrlMovie

func IsUrlMovie(s string) bool

func ListFileNames

func ListFileNames(path string, prefix string) ([]string, error)

列举目录内所有文件 prefix 调用时传""

func Md5File

func Md5File(path string) (string, error)

func ReadFile

func ReadFile(filePath string) ([]byte, error)

func RemoveDirContents

func RemoveDirContents(dir string) error

func SplitFile

func SplitFile(filePth string, saveDir string, chunkSize int64) ([]string, error)

切割大文件为多个小文件, 返回切片后的路径数组, 如果文件大小小于chunkSize, 则返回空数组 saveDir 保存路径 chunkSize切割大小,1M 则1024*1024

func WriteFile

func WriteFile(content []byte, filePath string) error

覆盖写文件

Types

This section is empty.

Jump to

Keyboard shortcuts

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