archive

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetKindByExt

func GetKindByExt(fn string) (archive Kind, compress Kind, err error)

Types

type Decoder

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

func New

func New() *Decoder

New 初始化文档解码器

func Read

func Read(r io.Reader, path string) *Decoder

func Source

func Source(path string) *Decoder

func (*Decoder) Archive

func (d *Decoder) Archive(kind Kind) *Decoder

Archive 指定文档的打包类型: 支持 ZIP 和 TAR

func (*Decoder) Compress

func (d *Decoder) Compress(kind Kind) *Decoder

Compress 指定文档的压缩类型: 支持 TAR, ZIP, GZ, ZST, XZ, SNZ

func (*Decoder) DeCompress

func (d *Decoder) DeCompress(r io.Reader) (dr io.ReadCloser, err error)

DeCompress 解压

func (*Decoder) DirectKind

func (d *Decoder) DirectKind(name string) *Decoder

DirectKind 通过文件名来确定压缩类型

func (*Decoder) Extract

func (d *Decoder) Extract() (err error)

Extract 解包文档

func (*Decoder) GZ

func (d *Decoder) GZ() *Decoder

GZ 指定文档通过gzip压缩

func (*Decoder) Read

func (d *Decoder) Read(r io.Reader) *Decoder

Source 来源流

func (*Decoder) SNZ

func (d *Decoder) SNZ() *Decoder

SNZ 指定文档通过snappy压缩

func (*Decoder) SaveTo

func (d *Decoder) SaveTo(saveTo string) *Decoder

SaveTo 保存路径,如果是 TAR 或者 ZIP,必须是目录

func (*Decoder) Source

func (d *Decoder) Source(path string) *Decoder

Source 来源压缩文件路径,用来猜测压缩类型

func (*Decoder) Tar

func (d *Decoder) Tar() *Decoder

Tar 指定文档为tar打文档

func (*Decoder) TrimRootPath

func (d *Decoder) TrimRootPath(yes ...bool) *Decoder

TrimRootPath 解压时去掉最顶层的文件夹名称

func (*Decoder) Verbose

func (d *Decoder) Verbose(yes ...bool) *Decoder

Verbose 显示处理过程

func (*Decoder) WriteTo

func (d *Decoder) WriteTo() func(r io.Reader) error

WriteTo 解压流的方法

func (*Decoder) XZ

func (d *Decoder) XZ() *Decoder

XZ 指定文档通过xz压缩

func (*Decoder) ZST

func (d *Decoder) ZST() *Decoder

ZST 指定文档通过zstd压缩

func (*Decoder) Zip

func (d *Decoder) Zip() *Decoder

Zip 指定文档为zip打文档

type Kind

type Kind string

Kind 压缩类型

const (
	TAR Kind = "tar"
	ZIP Kind = "zip"
	GZ  Kind = "gz"
	ZST Kind = "zst"
	XZ  Kind = "xz"
	SNZ Kind = "snz"
)

Jump to

Keyboard shortcuts

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