MBS Xojo Developer Conference and Training
Join us from 3rd to 6th May 2017 in Berlin, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

UnZipMBS class

class, Compression, MBS Compression Plugin (Zip), class UnZipMBS,
Plugin version: 8.6, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: A class to decompress a zip archive.
// open zip archive
dim f as FolderItem=SpecialFolder.Desktop.Child("test.zip")
dim z as new UnZipMBS(f)

// let's start

// get details on this file:
dim info as UnZipFileInfoMBS = z.FileInfo
dim name as string = z.FileName

if left(name,8) <> "__MACOSX" then // ignore Mac special files for metadata
if z.Lasterror=0 then

// create output file (if you want to support folders, this needs to be changed. See other examples)
dim outfile as folderitem = GetFolderItem(Name)
dim b as BinaryStream = BinaryStream.Create(outfile, true)
dim s as string

// now read 100 KB chunks and write them to new file
b.Write s
loop until lenb(s)=0

// cleanup

end if
end if

// move to next file until we reach the end
loop until z.Lasterror<>0
This is a simple class which uses zlib and has some limitations:

  • only deflate as compression method
  • only one date per file is preserved
  • no resource forks on Mac OS
  • no text encoding handling
  • no Apple or Microsoft extensions for special file flags or permissions.

This class has no sub classes.

Some examples which use this class:

The items on this page are in the following plugins: MBS Compression Plugin.

UnZipFilePositionMBS   -   UpDownArrows

MBS Real Studio PDF Plugins