util

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteOldFiles

func DeleteOldFiles(folder string, n int) error

DeleteOldFiles 刪除 folder 裡 n 個最舊的檔案。

func PathExists

func PathExists(name string) bool

func PathNotExists

func PathNotExists(name string) (ok bool)

TODO: 改名 PathNotExists

func RemainNewFiles

func RemainNewFiles(folder string, n int64) error

RemainNewFiles 刪除 folder 裡的舊檔案, 剩下 n 個最新的檔案。

func SortStrings

func SortStrings(x []string)

func WrapErrors

func WrapErrors(allErrors ...error) (wrapped error)

WrapErrors 把多个错误合并为一个错误.

func ZipFiles

func ZipFiles(zipFilePath string, files []ZipFile) error

ZipFiles 创建一个压缩包,把 files 打包到 zipFilePath.

func ZipPaths

func ZipPaths(zipFilePath string, paths []string) error

ZipPaths 创建一个压缩包,把 paths 的文件打包到 zipFilePath.

Types

type ZipFile

type ZipFile struct {
	Name string
	Path string
}

ZipFile 方便自定义每个文件的文件名。

Jump to

Keyboard shortcuts

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