archive

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultHandler

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

DefaultHandler The normal procedure should look like this.

  1. CreateZipArchiveFile
  2. InitialiseZipWriter
  3. AppendFileToArchive (n times)
  4. Close

func (*DefaultHandler) AppendFileToArchive

func (ar *DefaultHandler) AppendFileToArchive(fileToZipPath string, filepathInZip string) error

AppendFileToArchive takes a path to file that is read and appended to an archive. make sure to call the Close method when you're done with appending files to the archive.

func (*DefaultHandler) Close

func (ar *DefaultHandler) Close() error

func (*DefaultHandler) CreateZipArchiveFile

func (ar *DefaultHandler) CreateZipArchiveFile(zipFilePath string) (io.Writer, error)

CreateZipArchiveFile creates the file that will be the zip archive. The zipFilePath expects a complete path with the correct file extension (.zip). If you not intend to create an io.Writer beforehand this method can be the input of InitialiseZipWriter.

func (*DefaultHandler) InitializeZipWriter

func (ar *DefaultHandler) InitializeZipWriter(zipFile io.Writer)

InitializeZipWriter takes an existing io.Writer and initializes a zip.Writer based on it.

func (*DefaultHandler) WriteFilesIntoArchive

func (ar *DefaultHandler) WriteFilesIntoArchive(filePaths []string, closeAfterFinish bool) error

type Handler

type Handler interface {
	CreateZipArchiveFile(zipFilePath string) (io.Writer, error)
	InitializeZipWriter(zipFile io.Writer)
	AppendFileToArchive(fileToZipPath string, filepathInZip string) error
	Close() error
	WriteFilesIntoArchive(filePaths []string, closeAfterFinish bool) error
}

func InitInPath

func InitInPath(filePath string) (Handler, error)

func NewHandler

func NewHandler() Handler

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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