This command, part of zlib, adds a compressing or decompressing transformation to channel. The type of transformation is given by the mode, which must be one of compress, decompress, deflate, inflate, gzip, gunzip.
The following options may be used:
The following fconfigure/chan configure options are added:
To reverse the zlib push, use chan pop.
DKF: Be aware that the current implementation of the compressing and (especially) decompressing filters doesn't support seeking. If you can help improve this, please contact the Tcl Maintainers, on mailto:[email protected]
MAKR 2009-05-05: I cannot think of a sensible implementation for seeking in deflated data. You'd either have to buffer the inflated data, or restart inflating the block to seek to every time. The first one either blows the memory or stores the data in some cache file. The second possibility would need a buffer, too, but suffers more from performance penalty. Storing the data in some file bothers me also wrt security. I have an zlib channel implementation for Tcl 8.4 using the zlib bindings provided in Tclkit wrapped up with rechan. I was thinking a lot about how to implement seeking, but finally realized that what I want is seeking in the inflated data. Thus no seeking in the channel implementation, and I haven't missed it yet :-) ...
DKF: I don't need it personally, but others have asked for it and I know it must be possible from how other routines in zlib work (which aren't compatible with Tcl's channel system). I make no claims for efficiency; seekability conflicts with efficient compression AIUI...