On Thu, Jan 28, 2010 at 1:44 PM, Petite Abeille
<petite_abeille@mac.com> wrote:
On Jan 28, 2010, at 8:40 PM, Phoenix Sol wrote:
> Anyone have any intel on this library, lzlib
Tiago Dionizio's lzlib?
http://luaforge.net/projects/lzlib/
Yes, that one; sorry.
If yes, here is an usage example:
local ok, zlib = pcall( require, 'zlib' )
if ok and zlib then
local aContent = tostring( aResponse.content )
local zContent = zlib.compress( aContent, 9, nil, 15 + 16 )
if zContent:len() < aContent:len() then
aResponse.header[ 'content-encoding' ] = 'gzip'
aResponse.header[ 'etag' ] = nil
aResponse.content = zContent
end
end
Right, I had no problem trying out compress() and uncompress() (although the options are still kinda mysterious).
What I'm trying to understand is how to process in a stream, from a source to a sink without necessarily holding the entire message body in a buffer; the userdata returned by compressobj() and decompressobj() seem to be what I'm after but so far I don't quite grok them.
Thanks for your help.