Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
zlib bindings for Chicken Scheme
Scheme
Branch: master

version 0.5.1, dependency fix

git-svn-id: https://code.call-cc.org/svn/chicken-eggs/release/4/zlib/trunk@23207 fca3e652-9b03-0410-8d7b-ac86a6ce46c4
latest commit 737bcd9c55
joseph.gay authored

README.org

zlib bindings for Chicken Scheme

zlib is a popular data compression library that uses the DEFLATE algorithm internally. It is defined in RFC 1950.

Procedures

These bindings provide two procedures:

(open-zlib-compressed-input-port [INPUT-PORT])
(open-zlib-compressed-output-port [OUTPUT-PORT])

The first is for inflating an existing zlib stream and the second for deflating data into a new stream.

Examples

Inflating a stream:

(with-input-from-port (open-zlib-compressed-input-port)
  read-string)

Deflating a stream:

(with-output-to-port (open-zlib-compressed-output-port)
  (lambda ()
    (write-string (read-string))
    (close-output-port (current-output-port))))  

Notes

  • This is expecting the zlib format, not raw DEFLATE or the gzip format, which are defined in RFCs 1951 and 1952 respectively.
  • When finished deflating, it is important to always close the zlib output-port. This will ensure that the zlib trailing data is written along with any data still buffered. The destination port will remain open after the zlib port is closed.

Tasks

expose compression level settings (currently uses level 6, the default)

test on low memory environment (currently uses a hard-coded chunk size of 32k)

improve general efficiency of memory usage

Something went wrong with that request. Please try again.