Platforms to show: All Mac Windows Linux Cross-Platform

ZipMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Compression MBS Compression Plugin 8.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The class for writing to a zip file.

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 encoding handling
  • no Apple or Microsoft extensions for special file flags or permissions.

But it works nice to provide a zip file to clients. For example a download of JPEG files in an archive with one download from Web Edition.

Be aware that you can't compress Mac applications with this class, as the we don't preserve permissions, so the decompressed file has not the right flags set to make it executable.

See also ArchiveReaderMBS and ArchiveWriterMBS classes for more features and compression formats.

  • 4 properties
  • 9 methods
    • method Close(GlobalComment as string="")
    • method CloseFile
    • method CloseFileRaw(UncompressedSize as Integer, CRC32 as Integer)
    • method Constructor(file as folderitem, append as Integer = 0)
    • method CreateFile(Filename as string, FileInfo as ZipFileInfoMBS, ExtraLocal as string = "", ExtraGlobal as string = "", Comment as String = "", CompressionMethod as Integer = 8, Level as Integer = 9, Zip64 as boolean = false)
    • method CreateFile(Filename as string, FileInfo as ZipFileInfoMBS, ExtraLocal as string, ExtraGlobal as string, Comment as String, CompressionMethod as Integer, Level as Integer, Zip64 as boolean, Raw as boolean)
    • method CreateFile(Filename as string, FileInfo as ZipFileInfoMBS, ExtraLocal as string, ExtraGlobal as string, Comment as String, CompressionMethod as Integer, Level as Integer, Zip64 as boolean, Raw as boolean, WindowBits as Integer, MemLevel as Integer, Strategy as Integer, Password as string, crcForCtypting as UInt32)
    • method CreateFile(Filename as string, FileInfo as ZipFileInfoMBS, ExtraLocal as string, ExtraGlobal as string, Comment as String, CompressionMethod as Integer, Level as Integer, Zip64 as boolean, Raw as boolean, WindowBits as Integer, MemLevel as Integer, Strategy as Integer, Password as string, crcForCtypting as UInt32, versionMadeBy as UInt32, flagBase as UInt32)
    • method Write(data as string)
  • shared method CompressFiles(ZipFile as FolderItem, SourceFolder as FolderItem, files() as string, Overwrite as Integer = 0, Password as string = "", CompressionLevel as Integer = 9, byref ErrorMessage as string) as Integer
  • 18 constants

Constants

Constant Value Description
AppendStatusAddInZip 2 One of the values for the constructor.
AppendStatusCreate 0 One of the values for the constructor.
AppendStatusCreateAfter 1 One of the values for the constructor.
CompressionBestCompression 9 One of the compression level constants.
CompressionBestSpeed 1 One of the compression level constants.
CompressionDefault -1 One of the compression level constants.
CompressionNo 0 One of the compression level constants.
MethodDeflated 8 One of the compression method constants.
MethodNone 0 One of the compression method constants. Use this value for no compression.
StrategyDefault 0 One of the strategy modes.
StrategyFiltered 1 One of the strategy modes.
StrategyFixed 4 One of the strategy modes.
StrategyHuffmanOnly 2 One of the strategy modes.
StrategyRLE 3 One of the strategy modes.
ZipBadZipFile -103 One of the error constants.
ZipInternalError -104 One of the error constants.
ZipOk 0 One of the error constants.
ZipParameterError -102 One of the error constants.

This class has no sub classes.

Some examples using this class:

Blog Entries

Xojo Developer Magazine


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


ZipFileInfoMBS   -   ZLibCompressMBS


The biggest plugin in space...