Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Lua
  3. lua-zlib

lua-zlib

NOASSERTIONCv1.4

A Lua library providing a functional, streaming interface to zlib for compression and decompression.

GitHubGitHub
288 stars110 forks0 contributors

What is lua-zlib?

lua-zlib is a Lua binding for the zlib compression library that provides a functional, streaming interface for compressing and decompressing data. It solves the problem of efficiently handling large or continuous data streams in Lua applications by allowing incremental processing without requiring full data loading into memory.

Target Audience

Lua developers working with data compression, network protocols, file I/O, or serialization who need efficient streaming compression/decompression capabilities.

Value Proposition

Developers choose lua-zlib for its simple, streaming API that mirrors zlib's functionality closely, offering fine-grained control over compression parameters and memory usage while being lightweight and compatible with existing Lua ecosystems.

Overview

Simple streaming interface to zlib for Lua.

Use Cases

Best For

  • Compressing network payloads in Lua-based servers
  • Processing large log files or data streams incrementally
  • Implementing gzip compression for HTTP responses in Lua
  • Adding checksum verification to data pipelines
  • Replacing lzlib with a streaming-compatible alternative
  • Handling concatenated gzip archives in Lua scripts

Not Ideal For

  • Projects needing simple, one-shot compression functions without stream management
  • Environments where installing zlib as an external dependency is impractical
  • Use cases requiring compression algorithms beyond zlib's deflate/gzip, like LZMA or Brotli
  • Quick Lua scripts that compress small data and would benefit from a more abstracted API

Pros & Cons

Pros

Efficient Streaming API

Provides deflate and inflate functions that process data in chunks, enabling handling of large streams without full memory loading, as demonstrated in the concatenated stream example.

Flexible Compression Control

Allows adjustment of compression levels (1-9), window sizes, and flush options like sync, full, and finish, giving fine-grained control over performance and output.

Incremental Checksum Support

Offers adler32 and crc32 checksum factories that can be updated incrementally, useful for verifying data integrity in pipelines, with examples for all-in-one or multi-call usage.

Handles Concatenated Gzip Streams

Correctly inflates multiple concatenated gzip files by managing EOF and byte counts, as shown in the README example with seek and shift handling.

Cons

External zlib Dependency

Requires zlib to be installed separately, which complicates deployment on platforms without easy package management or in restricted environments.

Stream Management Complexity

The API demands careful handling of flush options and EOF states; errors like calling stream after finish lead to IllegalState errors without built-in safeguards, increasing debugging effort.

lzlib Compatibility Issues

The shim for lzlib has incompatibilities, such as version() returning a numeric tuple instead of a string and checksum functions behaving differently, which can break drop-in replacement attempts.

Frequently Asked Questions

Quick Stats

Stars288
Forks110
Contributors0
Open Issues3
Last commit8 months ago
CreatedSince 2009

Tags

#gzip#inflate#deflate#checksum#streaming#data-processing#lua#compression#zlib

Built With

L
Lua
C
C++

Included in

Lua4.5k
Auto-fetched 9 hours ago

Related Projects

lua-ziplua-zip

Lua binding to libzip.

Stars88
Forks26
Last commit4 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub