file

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: MulanPSL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCopySrcExists      = errors.New("拷贝文件时目标文件存在")
	ErrCopyOriginalExists = errors.New("拷贝文件时源文件不存在")
)

Functions

func Bytes2GB

func Bytes2GB(bytes int64) float64

将字节数装换成Gb @param bytes 字节

func Bytes2MByes

func Bytes2MByes(bytes int64) float64

将字节数转换成兆 @param bytes 字节数

func BytesToString

func BytesToString(bytes int64) string

将字节数转换成一个人类可读的字符串 @param bytes 字节

func CopyFile

func CopyFile(original string, src string) error

将一个文件拷贝到指定目录下 @param original 源文件路径 @param src 目标文件路径

func CreateNullFolder

func CreateNullFolder(catalog string) error

建立一个空目录 @param catalog 节点目录

func FileExists

func FileExists(filePath string) (bool, error)

检查一个文件是否存在 @param filePath 文件路径

func FileMd5

func FileMd5(path string) (string, error)

获取一个文件的md5值 @param path 文件路径

func FileSize

func FileSize(path string) (int64, error)

获取文件大小 @param path 文件路径

func FolderExists

func FolderExists(path string, isCreate bool) (bool, error)

检查一个文件夹是否存在 若不存在运行自行创建 @param path 文件夹路径 @param isCreate 若文件夹不存在,是否自动创建

func ReadFolder

func ReadFolder(path string, isRecursive bool) ([]string, error)

获取一个路径下的全部文件 @param path 读取路径 @param isRecursive 是否递归读取

func ValidateFileSign

func ValidateFileSign(localPath string, fileMd5 string, fileSize int64) error

验证文件签名 @param localPath 本地路径 @param fileMd5 文件md5 @param fileSize 文件大小

func WriterFile

func WriterFile(path string, content []byte) error

向一个路径中写入文件 @param path 文件路径 @param content 文件内容

func WriterFileByAppend

func WriterFileByAppend(path string, content []byte) error

向一个路径中追加写入文件 @param path 文件路径 @param content 文件内容

Types

This section is empty.

Jump to

Keyboard shortcuts

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