← All notes

Go compress/zlib: read and write zlib compressed data

Answer: This package reads and writes compressed data in the zlib format from RFC 1950.

Readers and writers

A filter uncompresses bytes during reading.

A separate filter compresses bytes during writing.

NewWriter sends zlib data to a buffer.

NewReader is how you read that data back.

NewWriterLevel picks the compression level.

Errors and extras

ErrChecksum is returned when reading ZLIB data that has an invalid checksum.

NewReaderDict takes a reader and a dict.

The reader source imports flate and adler32.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Go, compress/zlib package reference; Go, compress/zlib source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Go, compress/zlib package reference; Go, compress/zlib source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors.

Cite this

Permanent ID: iil:note:rcadb0jr

iinventedlight. 2026. "Go compress/zlib: read and write zlib compressed data." iinventedlight Library, iil:note:rcadb0jr, version of 2026-11-24. https://iinventedlight.com/library/notes/go-compress-zlib/. License: CC-BY-4.0.

@misc{iil_note_rcadb0jr,
  author = {{iinventedlight}},
  title = {{Go compress/zlib: read and write zlib compressed data}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-24},
  url = {https://iinventedlight.com/library/notes/go-compress-zlib/},
  note = {Permanent ID iil:note:rcadb0jr. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/go-compress-zlib.md.