archive

package
v0.0.0-...-d930fad Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package archive xxx

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unpack

func Unpack(reader io.Reader, archiveType ArchiveType, dirPath string, limitFileSize int64) error

Unpack 解压zip、gzip、tar

Types

type ArchiveErrCode

type ArchiveErrCode int32

ArchiveErrCode 错误码 nolint:revive

const (
	// FileTooLarge 文件过大
	FileTooLarge ArchiveErrCode = 400413
)

type ArchiveType

type ArchiveType string

ArchiveType 文件类型 nolint:revive

const (
	// GZIP gzip
	GZIP ArchiveType = "GZIP"
	// ZIP zip
	ZIP ArchiveType = "ZIP"
	// TAR tar
	TAR ArchiveType = "TAR"
	// Unknown unknown
	Unknown ArchiveType = "Unknown"
)

func IdentifyFileType

func IdentifyFileType(buf []byte) ArchiveType

IdentifyFileType 检测文件类型:zip、zip、tar

type TgzArchive

type TgzArchive struct {
	// contains filtered or unexported fields
}

TgzArchive 实现了 Archive 接口,用于处理 gzip 文件

func NewTgzArchive

func NewTgzArchive(destPath string, limitFileSize int64) TgzArchive

NewTgzArchive xxx

func (TgzArchive) UnTar

func (t TgzArchive) UnTar(r io.Reader) error

UnTar decompresses a TAR archive and returns an error

func (TgzArchive) UnTgzPack

func (t TgzArchive) UnTgzPack(reader io.Reader) error

UnTgzPack decompresses the gzip archive and returns an error

type ZipArchive

type ZipArchive struct {
	// contains filtered or unexported fields
}

ZipArchive 实现了 Archive 接口,用于处理 zip 文件

func NewZipArchive

func NewZipArchive(destPath string, limitFileSize int64) ZipArchive

NewZipArchive xxx

func (ZipArchive) UnZipPack

func (z ZipArchive) UnZipPack(reader io.Reader) error

UnZipPack decompresses the zip package and receives the parameter io.Reader

func (ZipArchive) Unzip

func (z ZipArchive) Unzip(zipFile *os.File) error

Unzip decompresses the zip package and receives the parameter os.File

Jump to

Keyboard shortcuts

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