Ward

LZMA Compression UDF

6 posts in this topic

How to compress data in memory? The simplest way is to use the Native API Compression by trancexx. Here provides another way, using LZMA algorithm. LZMA is the default method of 7z format, provides a high compression ratio and very fast decompression.

In this UDF, embedded and external DLL are both supported. If "LZMA.DLL.AU3" (embedded binary) is not included in scripts, a external LZMA.DLL must exists. You can use external DLL if MemoryDll is not work for you.

Some tips:

  • Both LzmaEnc and LzmaDec only accept binary arguments. To compress string, StringToBinary and BinaryToString can help.
  • LzmaEnc can accept an extra argument, the comression level, from 1 to 9. For example: LzmaEnc($Binary, 9)
  • More settings are support by LzmaEncSetting, please see LZMA SDK.
  • This UDF is not for file compression. To compress files, 7-ZIP UDF is the better choice

Example:

#include "LZMA.AU3"
#include "LZMA.DLL.AU3"

Local $Source = Binary("LZMALZMALZMALZMALZMALZMALZMALZMALZMALZMA")
Local $Compressed = LzmaEnc($Source)
Local $Decompressed = LzmaDec($Compressed)

LZMA.zip

2 people like this

新版 _ArrayAdd 的白痴作者,不管是誰,去死一死好了

 

Share this post


Link to post
Share on other sites



This looks interesting, and is vital to my script. Can anyone here please eh... revive this? :mellow:

Sorry for the necrobump, I'd like a function that can decompress LZMA files without the requirement of an external DLL :)


Share this post


Link to post
Share on other sites

Might be better to check out this

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now