Recent

Author Topic: PV_Unpacker for ZIP, RAR, TAR  (Read 2456 times)

domasz

  • Sr. Member
  • ****
  • Posts: 315
PV_Unpacker for ZIP, RAR, TAR
« on: September 16, 2023, 10:19:40 am »
Here's my little library to unpack various files in pure Pascal.

Supported:
- ZIP (store & deflate)
- TAR
- RAR (store)
- RAR 5(store)

Does not support encryption.

It's a really simple library right now. You won't create a competitor to WinZIP or WinRAR with it but you can use it to:
- unpack TAR files (should unpack all TAR files)
- unpack most popular ZIP files and files based on ZIP (ODT, DOCX, JAR)

It can work fully on streams - can read archive from a stream and can extract all files to streams.

All input is welcome. If you find it has any value I will add more formats, subformats and features.

Usage example:
Code: Pascal  [Select][+][-]
  1. uses PV_Unpacker;
  2.  
  3. var i: Integer;
  4. begin
  5.   if not OpenDialog1.Execute then Exit;
  6.  
  7.   Unp := TUnpacker.Create(OpenDialog1.Filename); //or open from TStream
  8.  
  9.   if Unp.GetFormat = '' then ShowMessage('Unsupported'); //or:
  10.   if Unp.Count < 0 then ShowMessage('Unsupported');
  11.  
  12.   for i:=0 to Unp.Count-1 do begin
  13.     Memo1.Lines.Add( Unp.GetName(i) );
  14.   end;
  15.  
  16.   if Unp.CanUnpack(0) then Unp.Extract(0, 'output.jpg'); //or extract to TStream
  17.  
  18.   Unp.Free;
  19.  
« Last Edit: September 18, 2023, 11:48:21 am by domasz »

domasz

  • Sr. Member
  • ****
  • Posts: 315
Re: PV_Unpacker for ZIP, RAR, TAR
« Reply #1 on: September 18, 2023, 11:50:38 am »
Update- now supported:

- ZIP (store, deflate)
- RAR (store)
- LZH (store)
- TAR
- WAD (PWAD, IWAD, WAD2)
- BH
- PAK

domasz

  • Sr. Member
  • ****
  • Posts: 315
Re: PV_Unpacker for ZIP, RAR, TAR
« Reply #2 on: September 28, 2023, 07:00:37 pm »
More formats added. Now on Github:
https://github.com/PascalVault/Lazarus_Unpacker

domasz

  • Sr. Member
  • ****
  • Posts: 315
Re: PV_Unpacker for ZIP, RAR, TAR
« Reply #3 on: October 11, 2023, 07:13:48 pm »
And now you pack files to ZIP, TAR and more:
https://github.com/PascalVault/Lazarus_Packer

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 967
  • Professional amateur ;-P
Re: PV_Unpacker for ZIP, RAR, TAR
« Reply #4 on: October 19, 2023, 07:36:02 pm »
Hey Domasz,

Thank you very much for this effort, it's quite nice and very useful !!

Just have a very dumb question due to some very fiery curiosity: Why separate the Pack and Unpack into different repos?

Cheers,
Gus
Lazarus 2.3.0(trunk) FPC 3.3.1(trunk) Ubuntu 23.04 64b Dark Theme
Lazarus 2.2.6(stable) FPC 3.2.2(stable) Ubuntu 23.04 64b Dark Theme
http://github.com/gcarreno

domasz

  • Sr. Member
  • ****
  • Posts: 315
Re: PV_Unpacker for ZIP, RAR, TAR
« Reply #5 on: October 19, 2023, 07:48:36 pm »
Thank you very much for this effort, it's quite nice and very useful !!
Thank you!

Why separate the Pack and Unpack into different repos?
It's easier for me to maintain 2 repos. In the future they will most likely be merged.

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 967
  • Professional amateur ;-P
Re: PV_Unpacker for ZIP, RAR, TAR
« Reply #6 on: October 20, 2023, 06:12:32 pm »
Hey Domasz,

Thank you!

You're more than welcome!!

It's easier for me to maintain 2 repos. In the future they will most likely be merged.

Understandable!!

Thanks for taking the time to answer!!

Cheers,
Gus
Lazarus 2.3.0(trunk) FPC 3.3.1(trunk) Ubuntu 23.04 64b Dark Theme
Lazarus 2.2.6(stable) FPC 3.2.2(stable) Ubuntu 23.04 64b Dark Theme
http://github.com/gcarreno

domasz

  • Sr. Member
  • ****
  • Posts: 315
Re: PV_Unpacker for ZIP, RAR, TAR
« Reply #7 on: November 03, 2023, 07:09:16 pm »
The library got more features and more formats. There is even a simple but useful demo

 

TinyPortal © 2005-2018