[fpc-pascal] Unzip streams

Luca Olivetti luca at ventoso.org
Fri Mar 15 00:30:06 CET 2019


El 14/3/19 a les 23:23, Darius Blaszyk ha escrit:
> Hi,
> 
> I would like to unzip a file that contains folders and files from a 
> stream. Can this be done with TUnzipper? Anyone has an example?

procedure ZipInstall(const sourcezip, destdir: string; 
splashwindow:TSplashWindow);
   var unzipper:TUnZipper;
   begin
     unzipper:=TUnzipper.create;
     unzipper.FileName:=sourcezip;
     unzipper.OutputPath:=destdir;
     unzipper.examine;
     splashwindow.FileCount:=unzipper.Entries.Count;
     unzipper.OnStartFile:=@splashwindow.OnStartFile;
     unzipper.UnZipAllFiles;
     unzipper.free;
   end;


(TSplashWindow is a form where I show the progress)

I never tried but if you want to use a stream, instead of setting 
FileName you can assign OnOpenInputStream and create a stream there.

Bye
-- 
Luca



More information about the fpc-pascal mailing list