ziparch

package
v0.0.0-...-63016fa Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ZipArchive

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

ZipArchive is a struct to create zip archive for given files and directories via Add(). Close() must be called after all files are added successfully.

func NewZipArchive

func NewZipArchive(dest io.Writer) *ZipArchive

NewZipArchive returns a new ZipArchive.

func (*ZipArchive) Add

func (za *ZipArchive) Add(ctx context.Context, path string, info fs.FileInfo, src io.Reader) error

Add creates a zip header from info and adds the file to the zip archive. If given path is a directory, it will be added as a directory and src will be ignored.

func (*ZipArchive) Close

func (za *ZipArchive) Close() error

Close closes the zip archive to flush the contents and finalize the zip file.

Jump to

Keyboard shortcuts

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