file

package
v0.0.0-...-5aea0a9 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: GPL-3.0 Imports: 18 Imported by: 152

Documentation

Overview

Package file 文件实用工具

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyBody   = errors.New("read body len <= 0")
	ErrInvalidPath = errors.New("invalid path")
)
View Source
var BOTPATH = Pwd()

BOTPATH BOT当前路径

View Source
var (
	// SkipOriginal 直接从镜像站获取数据
	SkipOriginal = false
)

Functions

func DownloadTo

func DownloadTo(url, file string) error

DownloadTo 下载到路径

func GetCustomLazyData

func GetCustomLazyData(dataurl, path string) ([]byte, error)

GetCustomLazyData 获取自定义懒加载数据, 不进行 md5 验证, 忽略 data/Abcde/ 路径. 传入的 path 的前缀 data/abcde/ 将被删去 以便进行下载, 但保存时仍位于 data/abcde/xxx

func GetLazyData

func GetLazyData(path, stor string, isDataMustEqual bool) (data []byte, err error)

GetLazyData 获取公用懒加载数据 传入的 path 的前缀 data/ 在验证完 md5 后将被删去 以便进行下载, 但保存时仍位于 data/Abcde/xxx

func IsExist

func IsExist(path string) bool

IsExist 文件/路径存在

func IsNotExist

func IsNotExist(path string) bool

IsNotExist 文件/路径不存在

func Pwd

func Pwd() (path string)

Pwd 获取当前路径

func Size

func Size(path string) (n int64)

Size 获取文件大小

Types

This section is empty.

Jump to

Keyboard shortcuts

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