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


Humphrey. 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:
ZipFile: TZipFile;
SS: TStringStream;
ZipDocument = ‘’;
ZipFile := TZipFile.Create; //Zipfile: TZipFile
SS := TStringStream.Create(‘hello’);
if FileExists(ZipDocument) then
ZipFile.Open(ZipDocument, zmReadWrite)
ZipFile.Open(ZipDocument, zmWrite);
ZipFile.Add(SS, ‘document.txt’);
Head over and check out the full blog post about TZipFile for Delphi XE6 Firemonkey.

Comments are closed.