Skip to content

JuliaIO/GZip.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

211 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GZip.jl

Documentation CI

A Julia interface for gzip functions in zlib. Provides GZipStream for reading and writing gzip files, with zlib-ng support and gzip header metadata access.

Defaults to the zlib-ng backend for up to 2.5x faster compression. Standard zlib is also available via backend=GZip.ZLIB.

Quick Start

using GZip

# Write
GZip.open("data.gz", "w") do io
    write(io, "hello world")
end

# Read
data = GZip.open(read, "data.gz")

# Header metadata
h = gzheader("data.gz")
h.name     # original filename
h.mtime    # modification time

Use the standard zlib backend if needed:

GZip.open("data.gz", "w"; backend=GZip.ZLIB) do io
    write(io, "compressed with zlib")
end

Files are cross-compatible between backends.

GZip.jl vs CodecZlib.jl

For most users, we recommend CodecZlib.jl. It provides a more complete and well-tested IO interface via TranscodingStreams.jl, supports in-memory compression, and handles gzip, zlib, and raw deflate formats.

GZip.jl is a thin wrapper around zlib's gz* C functions, which handle file I/O and paths directly in C rather than through Julia's IOStream. This means GZip.jl does not benefit from the ongoing work in Base Julia to make file I/O and path handling behave consistently across all supported platforms. It is useful if you specifically need zlib-ng performance or gzip header metadata access, but its IO implementation is less complete and less widely tested (8 direct dependents vs CodecZlib.jl's 149).

GZip.jl CodecZlib.jl
Recommended for most users Yes
IO interface completeness Partial Full (via TranscodingStreams)
Best for File-based gzip I/O General-purpose streaming compression
zlib-ng support Yes (default backend) No
In-memory compress/decompress No Yes
Raw deflate/zlib format No (gzip only) Yes
Header metadata Yes (gzheader) No

Use GZip.jl when you need zlib-ng performance or gzip header metadata access.

Use Inflate.jl if you want a pure Julia library for header metadata access and decompression.

Use ChunkCodecLibZlib.jl when you need one-shot in-memory compression with configurable compression level and output size hints.

Documentation

See the full documentation for details, including benchmarks.

About

A Julia interface for gzip functions in zlib

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages