System.Zip.TZipFile.Add

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure Add(const FileName: string; const ArchiveFileName: string = '';
Compression: TZipCompression = zcDeflate); overload;
procedure Add(Data: TBytes; const ArchiveFileName: string; Compression: TZipCompression = zcDeflate); overload;
procedure Add(Data: TStream; const ArchiveFileName: string; Compression: TZipCompression = zcDeflate;
AExternalAttributes: TFileAttributes = []); overload;
procedure Add(Data: TStream; LocalHeader: TZipHeader; CentralHeader: PZipHeader = nil); overload;

C++

void __fastcall Add(const System::UnicodeString FileName, const System::UnicodeString ArchiveFileName = System::UnicodeString(), TZipCompression Compression = (TZipCompression)(0x8))/* overload */;
void __fastcall Add(System::DynamicArray<System::Byte> Data, const System::UnicodeString ArchiveFileName, TZipCompression Compression = (TZipCompression)(0x8))/* overload */;
void __fastcall Add(System::Classes::TStream* Data, const System::UnicodeString ArchiveFileName, TZipCompression Compression = (TZipCompression)(0x8), System::Ioutils::TFileAttributes AExternalAttributes = System::Ioutils::TFileAttributes() )/* overload */;
void __fastcall Add(System::Classes::TStream* Data, const TZipHeader &LocalHeader, PZipHeader CentralHeader = (PZipHeader)(0x0))/* overload */;

Properties

Type Visibility Source Unit Parent
procedure
function
public
System.Zip.pas
System.Zip.hpp
System.Zip TZipFile

Description

Adds a memory file to the .zip file.

There are four overloads of this function, depending on the data that is added to the archive. Data can be added to the archive using the absolute path of a file, a TStream, or an array of bytes.

  • FileName represents the name of the file to be added.
  • ArchiveFileName is the full path of the file in the archive. If the parameter is not specified, the default value is ExtractFileName(FileName).
  • Compression indicates the compression mode; the default value is zcDeflate.
  • Data can be either a TStream or a TBytes that represents the data to be added to the archive.
  • AExternalAttributes represents the external attributes of the file.
  • LocalHeader is the local header data.
  • CentralHeader is a Pointer to an optional central header. If no central header is provided, the local header information is used.

To track the progress of the operation, use OnProgress.

See Also