ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / Archive functions
  • Properties specific to zipArchive variables
  • Functions that use zipArchive variables:
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
The zipArchive type is used to manipulate an archive file corresponding to one of the following formats: ZIP, CAB, RAR, WDZ, 7z, TAR, gzip or TGZ (TAR.GZ).. You can define and change the characteristics of this file using different WLanguage properties.
AndroidAndroid Widget The CAB format is not available.
Note: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
New in version 2025
WINDEVWEBDEV - Server codeWindowsLinuxiPhone/iPad The gzip format (.gz extension) is now supported.
Example
// Réalisation d'une archive de sauvegarde du répertoire "Mes Documents"
MonArchive is zipArchive
// Protection de l'archive par un mot de passe
MonArchive.Password = "secret"
// Création de l'archive
zipCreate(MonArchive, "s:\Sauvegardes\" + DateToString(DateSys(), "AAAA-MM-JJ") + ".zip")
// Ajout des fichiers
zipAddDirectory(MonArchive, SysDir(srMyDocuments))
// Fermeture de l'archive
zipClose(MonArchive)
Properties

Properties specific to zipArchive variables

The following properties can be used to handle zipArchive variables:
NameType usedEffect
ArchiveFormatInteger constantFormat of the archive file:
  • zipFormatCAB: File in CAB format.
  • zipFormatRAR: File in RAR format.
  • zipFormatWDZ: File in WDZ format.
  • zipFormatZIP: File in ZIP format.
  • zipFormat7Z: File in 7z format.
  • zipFormatTAR: File in TAR format.
  • zipFormatTARGZ: File in TGZ (TAR.GZ) or gzip format.
CompressedSize8-byte integerTotal compressed size of the files found in the archive.
This property is read-only.
CompressionLevelentierCompression level that must be used to add files into the archive.
For more details, see zipCompressionLevel.
FileArray of zipArchivedFileArray of files found in the archive.
NbFileentierNumber of files found in the archive.
This property is read-only.
NbPartentierNumber of parts in a multi-volume archive.
For a single-volume archive, this property is equal to 1.
This property is read-only.
PasswordCharacter stringPassword that will be used to add files into the archive or to extract files from the archive.
For more details, see zipPassword.
This property is available in write mode.
Format 7z: It is not possible to use a password.
TAR, gzip and TGZ format (TAR.GZ): It is not possible to use a password.
Size8-byte integerTotal size of the files in the archive (decompressed size).
This property is read-only.
Remarks

Functions that use zipArchive variables:

zipAddDirectoryAdds all the files found in a directory and in its subdirectories into an archive and compresses them.
zipAddFileAutomatically adds and compresses a file (of any type) in a CAB, ZIP, WDZ, 7z, TAR, gzip or TGZ (TAR.GZ) archive.
zipAddFileListAutomatically adds and compresses a list of files (of any type) in an archive in ZIP, CAB, WDZ, 7z, TAR, gzip or TGZ (TAR.GZ) format.
zipChangePathModifies the stored path of a file in an archive (in ZIP, WDZ or 7z format).
zipCloseCloses an archive.
zipCompressionLevelChanges the compression level used when creating an archive in ZIP format or in 7z format.
zipCreateCreates an archive.
zipCreateExeCreates a self-extracting archive as a 32-bit executable (.EXE).
zipCurrentFileReturns the name of the archived file currently handled by the functions for adding and extracting files.
zipDeleteAllDeletes all files from an archive.
zipDeleteFileDeletes a file from an archive.
zipDeleteFileListDeletes a list of files from an archive.
zipExistDetermines whether an archive exists.
zipExtractAllExtracts all files from an archive and decompresses them.
zipExtractFileExtracts a file from an archive and automatically decompresses it to a physical location or in memory.
zipExtractFileListExtracts and decompresses a list of files found in an archive to a physical location.
zipExtractPathReturns the path of a file found in the archive.
zipFileSizeReturns the size of one of the archive files (in CAB, RAR, WDZ, ZIP, 7z, gzip, TAR or TGZ (TAR.GZ) format):
  • the compressed size of the file.
  • the size of file before compression.
zipFindFileSearch for a file in an archive (CAB, ZIP, RAR, WDZ, 7z, gzip, TAR or TGZ (TAR.GZ) format).
zipInfoFileReturns the characteristics of a file found an archive:
  • The name of the file and its stored path.
  • The initial size of the file.
  • The compressed size of file.
  • The date and time of file creation.
  • The date and time of file modification.
  • The date and time of file access.
  • The file attributes.
  • The file encryption mode.
zipIsMultiReturns the type of the archive: single-part archive or multi-part archive.
zipListFileReturns the list of files found in an archive.
zipMergeMerges the different sub-archives found in a multi-part archive to create a single-part archive.
zipNbFileReturns the number of files found in an archive (in CAB, RAR, ZIP, WDZ or 7z format).
zipNbPartReturns the number of sub-archives (parts) in an archive in CAB, RAR, ZIP, WDZ, 7z, gzip, TAR or TGZ (TAR.GZ) format.
zipNbPartNeededReturns the number of parts of a given size required to split a single-part archive.
zipOpenOpens an existing archive.
zipOpenCABOpens an existing archive in CAB format.
zipOpenRAROpens an existing archive in RAR format.
zipPasswordDefines the password used to add files to the specified archive and to extract files from the specified archive (RAR, ZIP and WDZ format).
zipSizeReturns the size of the archive (in ZIP, RAR, CAB, WDZ, 7z, gzip, TAR or TGZ (TAR.GZ) format):
  • the size of all compressed files found in the archive.
  • the size of all files found in the archive before compression.
zipSplitSplits an archive into several sub-archives of a given size.
Minimum version required
  • Version 15
This page is also available for…
Comments
Function: Buffer to Serialize Array String, after Zip file with crypt
PROCEDURE SerializaCompactaArquivo(Token, bufArquivoBinario)

//Serializar
bufArquivoBinario = Crypt(bufArquivoBinario,Token,cryptAnsi,encodeBASE64)

NomeArquivoTxt is string = "Buffer"+DateSys()+TimeSys() + ".txt"
NomeArquivoZip is string = "Buffer"+DateSys()+TimeSys() + "zip"

fDelete(NomeArquivoTxt)
fDelete(NomeArquivoZip)

fSaveBuffer(NomeArquivoTxt,bufArquivoBinario)

NumZipErr is int

NumZipErr = zipCreate("Pacote", NomeArquivoZip)

IF NumZipErr <> 0 THEN
Error(zipMsgError(NumZipErr))
END

NumZipErr = zipAddFile("Pacote", NomeArquivoTxt, zipNone)

IF NumZipErr <> 0 THEN
Error(zipMsgError(NumZipErr) + "On the file " + zipCurrentFile("Pacote"))
END

zipCompressionLevel("Pacote", 9)

ok is boolean

IF fFileExist(NomeArquivoZip) THEN
ok = True
bufArquivoBinario = fLoadBuffer(NomeArquivoZip)
bufArquivoBinario = Crypt(bufArquivoBinario,Token,cryptAnsi,encodeBASE64)
ELSE
ok = False
bufArquivoBinario = ""
END

RESULT(bufArquivoBinario)
BOLLER
07 Jun. 2017

Last update: 09/21/2024

Send a report | Local help