Documentation ¶
Overview ¶
Package createzip is a helper to create a new zip file and add files into the zip file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DEBUG is debug mode. // Set to true to enable debug messages from this package. DEBUG = false )
Functions ¶
This section is empty.
Types ¶
type ZipFile ¶
type ZipFile struct {
// contains filtered or unexported fields
}
ZipFile is wrapper of zip.Writer.
func NewForHTTP ¶
func NewForHTTP(w http.ResponseWriter, zipFileName string) (zf *ZipFile)
NewForHTTP creates the downloadable zip for HTTP server dynamically.
func (*ZipFile) Add ¶
Add creates a new file in the zip and copy the content from io.Reader.
Params: fileNameInZip: file name(path) in the zip. r: io.Reader. It will copy the io.Reader to the new create file's writer.
func (*ZipFile) AddFile ¶
AddFile creates a new file in the zip and copy the content from the original source file.
Params: srcFilePath: original file path. fileNameInZip: file name(path) in the zip. If it's empty(""), the file name will be root dir of the zip("./") + file name without dir of original source file.
Click to show internal directories.
Click to hide internal directories.