checksum

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const OS_FILE_R_W = 0666

Variables

This section is empty.

Functions

func AddFolderSuffix

func AddFolderSuffix(folder string) string

AddFolderSuffix 为路径添加分隔符后缀

func ChecksumCrc32

func ChecksumCrc32(fileReader io.Reader) (uint32, error)

func ChecksumFilesWithCheckInfo

func ChecksumFilesWithCheckInfo(root string, checkInfo map[string]*ChecksumInfo, files []string) error

func CompareChecksumFiles

func CompareChecksumFiles(ctx context.Context, root string, checksumPath string) error

CompareChecksumFiles srcDir 校验目标文件夹 checksumPath 校验文件路径 ignores 忽略的文件

func GenerateChecksumFile

func GenerateChecksumFile(ctx context.Context, folder string, checksumName string) (checkSumPath string, err error)

GenerateChecksumFile 生成checksum文件

func GenerateChecksumFileWithIgnore added in v1.1.19

func GenerateChecksumFileWithIgnore(ctx context.Context, folder string, checksumName string, ignores []string) (checkSumPath string, err error)

GenerateChecksumFileWithIgnore 在排除某些文件的基础上,生成checksum

func GenerateChecksumMd5File

func GenerateChecksumMd5File(ctx context.Context, checksumPath string) (checksumMd5Path string, err error)

GenerateChecksumMd5File 生成checksum.md5文件

func GetCheckFileList

func GetCheckFileList(ctx context.Context, checkInfo map[string]*ChecksumInfo) []string

func GetChecksumInfo

func GetChecksumInfo(ctx context.Context, checksumPath string) (checkInfo map[string]*ChecksumInfo, err error)

func IsChecksumFileValid

func IsChecksumFileValid(ctx context.Context, checksumPath, md5Path string) bool

func PopulateFilePathsRecursively

func PopulateFilePathsRecursively(ctx context.Context, folder string, ignores []string) ([]string, error)

PopulateFilePathsRecursively 递归获取文件夹内所有文件的路径

Types

type ChecksumInfo

type ChecksumInfo struct {
	FilePath string
	Crc32Val string
	FileSize string
}

func GetFileInfo

func GetFileInfo(root, fileName string) (*ChecksumInfo, error)

Jump to

Keyboard shortcuts

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