4D Blog

Home Product LZMA: The new compression algorithm

LZMA: The new compression algorithm

October 6, 2021

Product

Whenever we exchange files, we always go through the ritual of compressing the files before sending them. Since 4D v18, two commands are available, allowing you to create and read a ZIP archive using the standard zip compression algorithm.

With 4D V19 R3, the Zip Create Archive command supports a new compression algorithm: LZMA. The advantage of this algorithm is that it creates smaller archives than the standard zip compression algorithm. Let’s find out more!

What Is LZMA?

LZMA is the acronym for Lempel-Ziv-Markov chain algorithm. LMZA is a lossless compression algorithm created by Igor Pavlov. This data compression algorithm uses a dictionary compression scheme similar to the LZ77 algorithm published by Abraham Lempel and Jacob Ziv.

How to use it?

You can pass a “zipArchive” object to the ZIP Create Archive command to customize your zip. This allows you to choose the compression algorithm, the encryption algorithm, and some other options. Read the documentation for more details.

For the compression algorithm, you can set the “compression” attribute to:

  • ZIP Compression None
  • ZIP Compression Standard
  • ZIP Compression LZMA
  • ZIP Compression XZ

 

For the compression level, you can set the “level” attribute between 1 to 10.

Here is an example that compresses a folder using the LZMA algorithm:

var $zip; $status : Object
var $destination : 4D.File
$zip:=New object
$zip.files:=New collection
$zip.files.push(Folder(fk documents folder).folder("Archive 2020"))
$zip.compression:=ZIP Compression LZMA
$zip.level:=4
$destination:=Folder(fk desktop folder).file("Archive2020.zip")
$status:=ZIP Create archive($zip; $destination)

Here is the result obtained on an archive of almost 2GB containing 1800 images:

Back to you! Do not hesitate to share your feedback and impressions on the forum.

Discuss

Tags Files and Folders, v19 R3, v20

Latest related posts

  • June 16, 2025

    Generate, share and use web sessions One-Time Passcodes (OTP)

  • May 20, 2025

    Automatic Refresh of OEM Build Licenses

  • May 16, 2025

    New class to handle incoming TCP connections

Vanessa Talbot
Vanessa Talbot
• Product Owner •Vanessa Talbot joined 4D Program team in June, 2014. As a Product Owner, she is in charge of writing the user stories then translating it to functional specifications. Her role is also to make sure that the feature implementation delivered is meeting the customer need.Since her arrival, she has worked to define key features in 4D. She has worked on most of preemptive multi-threading new features and also on a very complex subject: the new architecture for engined application. Vanessa has a degree from Telecom Saint-Etienne. She began her career at the Criminal Research Institute as a developer for the audiovisual department. She has also worked in media and medical fields as expert in technical support, production as well as documenting new features.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • 4D View Pro
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor
Subscribe to 4D Newsletter

© 2025 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy