UnZipMBS methods

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

Back to UnZipMBS class.

UnZipMBS.Close

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Compression MBS Compression Plugin 8.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Close a ZipFile.

Use CloseCurrentFile to close any open file before using Close.
Lasterror is UnZipOK on success.

UnZipMBS.CloseCurrentFile

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Compression MBS Compression Plugin 8.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Close the file in the zip archive opened with OpenCurrentFile.

Lasterror is set to UnzipCRCError if all the file was read but the CRC was not correct.

Some examples using this method:

UnZipMBS.Comment as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Compression MBS Compression Plugin 8.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Get the global comment string of the ZipFile.

UnZipMBS.CommentSize as UInt32

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Compression MBS Compression Plugin 8.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Size of the global comment of the zipfile.

UnZipMBS.Constructor(data as memoryblock)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Compression MBS Compression Plugin 10.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Open a Zip file from data in the memoryblock.

The Handle property is zero on failure and not zero on success.
The memory block must have a known size.

See also:

UnZipMBS.Constructor(data as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Compression MBS Compression Plugin 10.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Open a Zip file from data in the string.

The Handle property is zero on failure and not zero on success.

See also:

UnZipMBS.Constructor(file as folderitem)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Compression MBS Compression Plugin 8.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Open a Zip file from a file.

The Handle property is zero on failure and not zero on success.

If you run this class in a thread, please make sure your thread has a big stack (1 MB or more). Else it will crash.

See also:

UnZipMBS.Constructor(file as folderitem, Offset as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Compression MBS Compression Plugin 11.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Open a Zip file from a file starting at the offset.

The Handle property is zero on failure and not zero on success.

See also:

UnZipMBS.Count as UInt64

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Compression MBS Compression Plugin 8.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Total number of entries in the zip archive.

This value is stored in the zip archive as 16 bit integer, so maximum value is 65535. The plugin can extract more files than that number.

UnZipMBS.EOF as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Compression MBS Compression Plugin 8.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns 1 if you are on the end of a file.

This is not to test whether you are on the end of the zip archive.

UnZipMBS.ExtractFiles(DestFolder as FolderItem, ExtractWithoutPath as boolean = false, Overwrite as Boolean = false, Password as String = "", byref ErrorMessage as String) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Compression MBS Compression Plugin 16.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Simple function to extract all files from archive into folder.
Example
dim f as FolderItem = SpecialFolder.Desktop.Child("test.zip")

dim folder as FolderItem = SpecialFolder.Desktop.Child("test")
folder.CreateAsFolder

dim u as new UnZipMBS(f)
dim error as string
if u.ExtractFiles(folder, error) then
MsgBox "OK"
else
MsgBox "Error: "+error
end if

DestFolder: Destination folder.
ExtractWithoutPath: If true, all files are put in one folder.
Overwrite: Whether to allow overwriting files.
Password: The password to decrypt files.
ErrorMessage: An english error message.

Returns true on success or false on failure.
This function does not restore file permissions or other metadata.
And it may not work with non ASCII characters.

If you need more control over files being extracted, stored or error checking, please use example projects coming with plugin.

Some examples using this method:

UnZipMBS.FileInfo as UnZipFileInfoMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Compression MBS Compression Plugin 8.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries file information for the current file.

Returns nil on any error.

Some examples using this method:

UnZipMBS.FileName as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Compression MBS Compression Plugin 8.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The filename of the current open file.

This name has no text encoding defined, as the plugin has no idea what text encoding was used. You may need to define the text encoding as being ASCII, Windows, MacRoman or whatever, when you work with this file name.
This name may include path components for folders.

UnZipMBS.FilePosition as UnZipFilePositionMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Compression MBS Compression Plugin 8.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The current file position.

You can read or set the current file you edit.
(Read and Write computed property)

UnZipMBS.GetLocalExtrafield as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Compression MBS Compression Plugin 8.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Read extra field from the current file (opened by unzOpenCurrentFile)

This is the local-header version of the extra field (sometimes, there is more info in the local-header version than in the central-header)

Some examples using this method:

UnZipMBS.GoToFirstFile

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Compression MBS Compression Plugin 8.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Set the current file of the zipfile to the first file.

Lasterror is UnzipOk on success.

Some examples using this method:

UnZipMBS.GoToNextFile

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Compression MBS Compression Plugin 8.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Set the current file of the zipfile to the next file.

Lasterror is UnzipOk if there is no problem and UnzipEndOfListError if the actual file was the latest.

Some examples using this method:

UnZipMBS.LocateFile(filename as string, CaseSensitive as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Compression MBS Compression Plugin 8.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Try locate the file filename in the zipfile.
Example
// open zip archive
dim f as FolderItem=SpecialFolder.Desktop.Child("test.zip")
dim z as new UnZipMBS(f)

// let's search the file
z.LocateFile "test.rtf",2

if z.Lasterror = z.UnzipOk then
dim info as UnZipFileInfoMBS = z.FileInfo
MsgBox "OK: "+str(info.UncompressedSize)+" bytes"
else
MsgBox "Failed."
end if

For the CaseSensitivity signification, see CompareFileNames. Text encoding must match the text encoding of the files.

Lasterror is UnzipOk if the file is found. It becomes the current file, UnzipEndOfListError if the file is not found.

UnZipMBS.Offset as UInt64

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Compression MBS Compression Plugin 8.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Get or set the current index of the file in the zip directory.

If you set this value, you basicly move to another file.
(Read and Write computed property)

UnZipMBS.OpenCurrentFile

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Compression MBS Compression Plugin 8.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Open for reading data the current file in the zipfile.

See also:

Some examples using this method:

UnZipMBS.OpenCurrentFile(byref method as Integer, byref level as Integer, raw as boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Compression MBS Compression Plugin 8.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Same than OpenCurrentFile, but opens file for reading raw data (not uncompressed).

if raw=true the file data is returned uncompressed. If raw is false, it is decompressed for you.
Method will receive the method of compression.
level will receive the level of compression.

See also:

UnZipMBS.OpenCurrentFile(byref method as Integer, byref level as Integer, raw as boolean, password as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Compression MBS Compression Plugin 8.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Same than OpenCurrentFile, but opens file for reading raw data (not uncompressed) and with a password.

if raw=true the file data is returned uncompressed. If raw is false, it is decompressed for you.
Method will receive the method of compression.
level will receive the level of compression.

See also:

UnZipMBS.OpenCurrentFile(password as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Compression MBS Compression Plugin 8.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Open for reading data the current file in the zipfile.

password is a crypting password.

See also:

UnZipMBS.Position as UInt64

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Compression MBS Compression Plugin 8.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns the current position in uncompressed data.

UnZipMBS.Position2 as UInt64

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Compression MBS Compression Plugin 11.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns the current position in compressed data.

This property is useful to show progressbar with progress over reading the original zip file.

UnZipMBS.ReadCurrentFile(size as Integer) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Compression MBS Compression Plugin 8.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Read bytes from the current file (opened by OpenCurrentFile).

Returns "" on any error or on file end.

Some examples using this method:

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


💬 Ask a question or report a problem