lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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/

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


http://dev.alt.textdrive.com/browser/HTTP/HTTPExtra.lua#L212