Get access to over 100 FireMonkey cross platform samples for Android, IOS, OSX, Windows, and Linux!

AndroidAppmethodCode SnippetComponentDelphiFiremonkeyIOSOSXWindows

Create And Extract Zip Files In Delphi XE6 Firemonkey On Windows, OSX, Android, And IOS

Delphi XE6 Firemonkey Zip File ComponentHumphrey. Hyunsoo Kim has a blog post up where he highlights the System.Zip unit which comes with Delphi XE6 Firemonkey. System.Zip.TZipFile was introduced in Delphi XE2 and it is basically a class for creating and extracting compressed ZIP files without any third party components required. I believe you should be able to use the TZipFile class on Android, IOS, Windows, and OSX. I did a test compile for Android and it compiled without any problems. The original blog post is in Korean so be sure to use Google Chrome to translate it for you. The blog post also gives a good run down of links to other third party ZIP compression components but most likely they will only run on Windows. I also found a helper class for TZipFile over on StackOverflow that implements updating a file within a ZIP archive as well so you can check that out too. System.Zip should also be available in AppMethod. Here is some sample code for using TZipFile from the StackOverflow page:
var
ZipFile: TZipFile;
SS: TStringStream;
const
ZipDocument = 'E:\document.zip';
begin
ZipFile := TZipFile.Create; //Zipfile: TZipFile
SS := TStringStream.Create('hello');
try
if FileExists(ZipDocument) then
ZipFile.Open(ZipDocument, zmReadWrite)
else
ZipFile.Open(ZipDocument, zmWrite);

ZipFile.Add(SS, 'document.txt');

ZipFile.Close;
finally
SS.Free;
ZipFile.Free;
end;
end;

Head over and check out the full blog post about TZipFile for Delphi XE6 Firemonkey.



Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

Related posts
AndroidComponentDelphiDemoFiremonkeyIOSLinuxOSXShowcaseWindows

Experience ChatGPT As A Native Cross-Platform Firemonkey Application

DelphiLibraryWindows

Run Large Language Models Entirely On The GPU With Delphi And Vulkan

Code SnippetDelphiDemoLibraryWindows

Add Real-Time AI Voice Conversations To Windows Applications

ComponentDelphiDemoLibraryWindows

Give AI Models Eyes, Ears, And Real-World Capabilities

Sign up for our Newsletter and
stay informed
[mailpoet_form id="1"]

Leave a Reply