archiveutil

package module
v0.0.0-...-eba7814 Latest Latest
Warning

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

Go to latest
Published: May 12, 2015 License: Apache-2.0 Imports: 6 Imported by: 0

README

archiveutil

Golang archive helper

Documentation

Index

Constants

View Source
const (
	ZIP = "zip"
	TAR = "tar"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Archive

type Archive interface {
	AddFile(filePath string) error
	AddFolder(folderPath string) error
	Close() error
}

func CreateArchive

func CreateArchive(archiveType string, w io.Writer) Archive

Create Archiver by archiveType. Supported archiveTypes: "zip"

type WriteFunc

type WriteFunc func(info os.FileInfo, file io.Reader, entryName string) (err error)

type Zip

type Zip struct {
	Writer *zip.Writer
}

func CreateZipArchive

func CreateZipArchive(w io.Writer) *Zip

Create Zip Archiver.

func (*Zip) AddFile

func (zipp *Zip) AddFile(filePath string) error

Add file to zip.

func (*Zip) AddFolder

func (zipp *Zip) AddFolder(folderPath string) error

Add hole folder to zip file.

func (*Zip) Close

func (zipp *Zip) Close() error

Close writer.

Jump to

Keyboard shortcuts

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