Module jls.util.zip.gzip

Provide gzip utility functions.

Functions

gzip.compressStream (sh[, header[, compressionLevel]]) Returns a jls.io.StreamHandler that will compress into the specified stream handler.
gzip.decompressStream (sh[, onHeader]) Returns a jls.io.StreamHandler that will decompress into the specified stream handler.


Functions

gzip.compressStream (sh[, header[, compressionLevel]])
Returns a jls.io.StreamHandler that will compress into the specified stream handler.

See jls.util.zip.Deflater

Parameters:

  • sh the stream handler to call with the deflated data
  • header table the gzip header table (optional)
  • compressionLevel number the compression level (optional)

Returns:

    the jls.io.StreamHandler

Usage:

    local gzip = require('jls.util.zip.gzip')
    local FileStreamHandler = require('jls.io.streams.FileStreamHandler')
    
    local sh = gzip.compressStream(FileStreamHandler:new('test.txt.gz'))
    FileStreamHandler.readAllSync('test.txt', sh)
gzip.decompressStream (sh[, onHeader])
Returns a jls.io.StreamHandler that will decompress into the specified stream handler.

See jls.util.zip.Inflater

Parameters:

  • sh the stream handler to call with the inflated data
  • onHeader function a function that will be called with the header table (optional)

Returns:

    the jls.io.StreamHandler

Usage:

    local gzip = require('jls.util.zip.gzip')
    local FileStreamHandler = require('jls.io.streams.FileStreamHandler')
    
    local sh = gzip.decompressStream(FileStreamHandler:new('test.txt'))
    FileStreamHandler.readAllSync('test.txt.gz', sh)
generated by LDoc 1.4.6