Zip 无压缩 (Delphi)

Zip without compression (Delphi)

我正在使用 Delphi 原生提供的 TZipFile class 我想知道 是否可以打包/解包不压缩,类似于unix.In本例中的tar命令,我们追求最大效率的文件提取和写入包。 谢谢

解决方法: zip-without-compression-delphi

关键是在 TZipFile.Add 过程中使用 ZcStored 选项。

附件是一个可以回答我的问题的工作示例,以防万一有人遇到同样的问题,Tom Brunberg

已经很好地解决了这个问题

// 使用 system.zip;

Procedure MakeZipFile;
Var
 fZip: TzipFile;
 PathZip, MyPathFile: String;
begin
 fZip := TZipFile.Create;
 Try
   PathZip := 'C:\example.zip';
   MyPathFile := 'C:\myfile.txt';
   fZip.Open(PathZip, zmWrite);
   fZip.Add(MyPathFile, '', ZcStored); // Thanks Tom
   fZip.Close;
 Finally
   fZip.Free; 
 end;
end;