filetool

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: GPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadTo

func DownloadTo(url, savePath string, chkcrt bool) (n int64, err error)

下载文件

func Excluder added in v0.0.7

func Excluder(list []string, s string) bool

排除文件

func FormatSize added in v0.0.3

func FormatSize(fileSize int64) (size string)

字节的单位转换 保留两位小数

func IsExist

func IsExist(path string) bool

IsExist 文件/路径存在

func LoadFontFaces

func LoadFontFaces(dc *gg.Context, points float64, path string, name string, filemap map[string][]*zip.File) error

打开map中的ttf文件

func Parsezip

func Parsezip(zipFile string, filemap map[string][]*zip.File) error

加载 zip 文件到 map

func Trim added in v0.0.7

func Trim(s string) string

Types

type Files

type Files struct {
	Name         string // 文件完整路径
	NameOnly     string // 文件完整路径(不带后缀)
	FileName     string // 完整文件名(不带路径)
	NameNosuffix string // 文件名(不带后缀和路径)
	Suffix       string // 文件的后缀(文件类型)
	Path         string // 路径(不带文件名)
}

文件路径

func Readir

func Readir(dir string, name, exclude []string) ([]Files, int, error)

获取 dir 包含的指定 name 的文件的绝对或相对路径, exclude 为排除列表,可为 nil

type Zipfs added in v0.0.6

type Zipfs struct {
	Ok   bool          // 是否存在
	Open bool          // 是否打开
	Err  error         // 错误
	Data io.ReadCloser //
	File *zip.File     //
}

func Findfile

func Findfile(path string, name string, open bool, filemap map[string][]*zip.File) Zipfs

查找map中的文件

Jump to

Keyboard shortcuts

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