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
- id: C1 claim: The package reads and writes zlib format compressed data. source: S1 evidence: "reading and writing of zlib format compressed data"
- id: C2 claim: The format is specified in RFC 1950. source: S1 evidence: "as specified in RFC 1950"
- id: C3 claim: ErrChecksum is returned for an invalid checksum. source: S2 evidence: "invalid checksum"
- id: C4 claim: The format is specified in RFC 1950. source: S2 evidence: "as specified in RFC 1950"
Sources
- [S1] compress/zlib package reference. Go. https://pkg.go.dev/compress/zlib . License: BSD-3-Clause. Accessed 2026-11-24.
- [S2] compress/zlib source. Go. https://go.dev/src/compress/zlib/reader.go . License: BSD-3-Clause. Accessed 2026-11-24.
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
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.},
}
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.
- go-compress-zlib.schema.json (schema; CC-BY-4.0)
- go-compress-zlib.table.json (table; CC-BY-4.0)
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.