Documentation
¶
Index ¶
- type DefaultHandler
- func (ar *DefaultHandler) AppendFileToArchive(fileToZipPath string, filepathInZip string) error
- func (ar *DefaultHandler) Close() error
- func (ar *DefaultHandler) CreateZipArchiveFile(zipFilePath string) (io.Writer, error)
- func (ar *DefaultHandler) InitializeZipWriter(zipFile io.Writer)
- func (ar *DefaultHandler) WriteFilesIntoArchive(filePaths []string, closeAfterFinish bool) error
- type Handler
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.
- CreateZipArchiveFile
- InitialiseZipWriter
- AppendFileToArchive (n times)
- 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 NewHandler ¶
func NewHandler() Handler
Click to show internal directories.
Click to hide internal directories.