Standard library / archive/zip

archive/zip.Writer

Stateful ZIP writer. Entry writers must finish before next entry; Close writes central directory. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
type Writer struct {  // Has unexported fields.}

Working Example

Example Snippetgo
package main
import (  "archive/zip"  "bytes"  "fmt")
func must(e error) {  if e != nil {    panic(e)  }}
func main() {  var b bytes.Buffer  var w *zip.Writer = zip.NewWriter(&b)  must(w.Close())  fmt.Println(b.Len() > 0)}
Go Reference