Golang archive/zip.Create() function usage example

package archive/zip

Create adds a file to the zip file using the provided name. It returns a Writer to which the file contents should be written. The name must be a relative path: it must not start with a drive letter (e.g. C:) or leading slash, and only forward slashes are allowed. The file's contents must be written to the io.Writer before the next call to Create, CreateHeader, or Close.

zip.Create() function usage example

 zipWriter := zip.NewWriter(buffer)
 writer : = zipWriter.Create("newfile.zip")

Advertisement