compress/gzip
Package gzip
Overview
Package gzip implements reading and writing of gzip format compressed files, as specified in RFC 1952.
Example (WriterReader)
package main import ( "bytes" "compress/gzip" "fmt" "io" "log" "os" "time" ) func main() { var buf bytes.Buffer zw := gzip.NewWriter(&buf) // Setting the Header fields is optional. zw.Name = "a-new-hope.txt" zw.Comment = "an epic space opera by George Lucas" zw.ModTime = time.Date(1977, time.May, 25, 0, 0, 0, 0, time.UTC) _, err := zw.Write([]byte("A long time ago in a galaxy far, far away...")) if err != nil { log.Fatal(err) }