Catalog · How the catalog works
Delphi-Free-Pascal-port-of-Unrar---RAR-decompressor
Delphi/Free Pascal port of Unrar - RAR decompressor
- ★ 14 on GitHub
Anyone may press Interesting, signed in or not. It helps others find this project.
README
Free Pascal/Delphi port of Unrar
This library allows you to unpack RAR (version 3-5) archives, password protected and not.
Works in Delphi XE and Lazarus
License
MIT The code cannot be used to recreate RAR compression.
Usage
Listing files:
uses Unrar;
var rar: TRarUnpacker;
ADate: TDateTime;
ASize: Int64;
AName: String;
begin
rar := TRarUnpacker.Create('pass.rar', 'pass'); //can also be pass.exe - RAR SFX
if not rar.CheckPassword then begin
ShowMessage('Incorrect password!');
rar.Free;
Exit;
end;
while rar.NextEntry(AName, ASize, ADate) do begin
Memo1.Lines.Add(AName);
end;
rar.Free;Extracting files:
var
rar : TRarUnpacker;
ADate: TDateTime;
ASize: Int64;
AName: String;
F : TFileStream;
OutDir, FullPath: String;
begin
OutDir := 'OutputDir\'; // destination directory
rar := TRarUnpacker.Create('pass.rar', '');
try
while rar.NextEntry(AName, ASize, ADate) do
begin
Memo1.Lines.Add(AName);
FullPath := IncludeTrailingPathDelimiter(OutDir) + AName;
ForceDirectories(ExtractFileDir(FullPath));
F := TFileStream.Create(FullPath, fmCreate);
try
rar.Extract(F);
finally
F.Free;
end;
end;
finally
rar.Free;
end;
