fileszip

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 7, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

README

fileszip

http下载多个文件后,并写入zip压缩文件

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultFilesZip = NewFilesZip()

Functions

func AsyncRead

func AsyncRead(params []Sources) io.Reader

func WriteFile

func WriteFile(params []Sources, writer io.Writer) (err error)

Types

type Client

type Client interface {
	Get(url string) (*http.Response, error)
}

type DefaultUserHook

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

func (*DefaultUserHook) TransPath

func (d *DefaultUserHook) TransPath(p Sources) string

type FilesZip

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

func NewFilesZip

func NewFilesZip(options ...Option) *FilesZip

func (*FilesZip) ASyncRead

func (f *FilesZip) ASyncRead(sources []Sources) io.Reader

ASyncRead 提供给入参为 io.Reader 的 函数使用

func (*FilesZip) WriteFile

func (f *FilesZip) WriteFile(sources []Sources, writer io.Writer) (err error)

WriteFile 可直接传入 io.Writer 使用,将zip文件内容直接写入到 writer

type Option

type Option func(f *FilesZip)

func SetClient

func SetClient(client Client) Option

func SetDebug

func SetDebug() Option

func SetUserHook

func SetUserHook(hook UserHook) Option

type Sources

type Sources struct {
	Url   string      `json:"url"`
	Extra interface{} `json:"extra"`
}

func (Sources) String

func (s Sources) String() string

type UserHook

type UserHook interface {
	TransPath(p Sources) string
}

Jump to

Keyboard shortcuts

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