Lunatik

crypto_compClass

Lua interface to synchronous compression algorithms.

Not built on 6.15 and later, whose kernel has no synchronous compression API.

Methods

crypto_comp:algname () Returns the driver-independent name of the algorithm the transform was allocated with.
crypto_comp:close () Releases the transform.
crypto_comp:compress (data, max_len) Compresses data.
crypto_comp:decompress (data, max_len) Decompresses data.

Methods in detail

crypto_comp:algname ()
Returns the driver-independent name of the algorithm the transform was allocated with.

Returns

    string
crypto_comp:close ()
Releases the transform. A to-be-closed variable holding the object releases it the same way. Calling it again does nothing, and every other method raises “closed object” afterwards.

Returns

    nil
crypto_comp:compress (data, max_len)
Compresses data.

Parameters

  • data string input data
  • max_len integer maximum size of compressed output

Returns

    string compressed data

Raises

on compression failure
crypto_comp:decompress (data, max_len)
Decompresses data.

Parameters

  • data string compressed input
  • max_len integer maximum size of decompressed output

Returns

    string decompressed data

Raises

on decompression failure