PureZIP library : ZIP / UNZIP files
Moderator: gnozal
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Update (both libs)
Changes :
- use option #PureZIP_RecursiveZeroDirs to add empty directories to archive (workaround).
(option #PureZIP_Recursive doesn't do it anymore)
See http://www.purebasic.fr/english/viewtopic.php?t=22607
Changes :
- use option #PureZIP_RecursiveZeroDirs to add empty directories to archive (workaround).
(option #PureZIP_Recursive doesn't do it anymore)
See http://www.purebasic.fr/english/viewtopic.php?t=22607
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
- Thorsten1867
- Addict
- Posts: 1372
- Joined: Wed Aug 24, 2005 4:02 pm
- Location: Germany
How can I overwrite a file in the zip?
My problem:
- I extract one file from the zip
- I work with it and change it
- I add the changed file to the zip
But, then it seems, I have the file two times in the zip and next time three times and so on.
My problem:
- I extract one file from the zip
- I work with it and change it
- I add the changed file to the zip
But, then it seems, I have the file two times in the zip and next time three times and so on.
Translated with http://www.DeepL.com/Translator
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
You can't : ZLIB does not provide any function to delete / update a file in an archive.Thorsten1867 wrote:How can I overwrite a file in the zip?
My problem:
- I extract one file from the zip
- I work with it and change it
- I add the changed file to the zip
But, then it seems, I have the file two times in the zip and next time three times and so on.
You could :
- use the ZLIB 'raw' functions
or
- extract the files you want to keep, erase and rebuild the archive
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Yes, you are right : 2 examples were not updated. It is fixed now (please download again).yoxola wrote:When I tried PureZIP for 4.0, I found the examples aren't updated to PB4 syntax and I go this:
PureZIP_SetCallack() is not a function, array, macro or linked list.
I have no clue about what it is
About the callback :
Old function PureZIP_SetCallback() was renamed to PureZIP_SetProgressionCallback(), and there is a new function PureZIP_SetCompressionCallback().
PureZIP_SetProgressionCallback() wrote:Set PureZIP progression callback address for the functions :
- PureZIP_ExtractFiles()
- PureZIP_AddFiles()
The callback is called each time a new file is processed.
Usefull to indicate the progress when many files are packed / unpacked.
See the new MiniZIP/MiniUNZIP sources for an example using both callbacks.PureZIP_SetCompressionCallback() wrote:Set PureZIP (de)compression callback address for the functions :
- PureZIP_Archive_Compress()
- PureZIP_Archive_Extract()
- PureZIP_ExtractFile()
- PureZIP_AddFile()
- PureZIP_ExtractFiles()
- PureZIP_AddFiles()
The callback is called in realtime during compression or decompression.
Usefull to indicate the progress when a big file is packed / unpacked.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Hello gnozal,
i try to test your lib with a 300 MB-Zip containing a single 2.2 GB-File. The
ZIP-File is correct (tested with WinZip) and there is enough space on my
harddisk but the Returnvalue of PureZIP_ExtractFiles is always #False.
Is there a restriction on files greater 2 GBs?
Thanks in advance & Greetings ... Kiffi
i try to test your lib with a 300 MB-Zip containing a single 2.2 GB-File. The
ZIP-File is correct (tested with WinZip) and there is enough space on my
harddisk but the Returnvalue of PureZIP_ExtractFiles is always #False.
Is there a restriction on files greater 2 GBs?
Thanks in advance & Greetings ... Kiffi
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Hmm, I don't know what the ZLIB (from http://www.winimage.com/zLibDll/) limit is ...Kiffi wrote:Hello gnozal,
i try to test your lib with a 300 MB-Zip containing a single 2.2 GB-File. The
ZIP-File is correct (tested with WinZip) and there is enough space on my
harddisk but the Returnvalue of PureZIP_ExtractFiles is always #False.
Is there a restriction on files greater 2 GBs?
Thanks in advance & Greetings ... Kiffi
PureZIP_ExtractFiles() returns #False if one of the involved ZLIB functions like unzOpen() fails, or if no file in the archive matches with the filemask.
Maybe you could try to unpack this file with the PureZIP_Archive_* functions ?
Note that ZLIB does not support the 'new' WinZIP compression algorithm PPMd.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
> Maybe you could try to unpack this file with the PureZIP_Archive_*
> functions ?
yes, i can read the content of the zip-file with PureZIP_Archive_Read() and
PureZIP_GetFileInfo(), but the uncompressed size is wrong (i think, this is the
reason why i cannot extract the file(?)).

// Edit:
Greetings ... Kiffi
> functions ?
yes, i can read the content of the zip-file with PureZIP_Archive_Read() and
PureZIP_GetFileInfo(), but the uncompressed size is wrong (i think, this is the
reason why i cannot extract the file(?)).

// Edit:
http://www.zlib.net/zlib_faq.html#faq32zlib_faq wrote:# Can zlib work with greater than 4 GB of data?
Yes. inflate() and deflate() will process any amount of data correctly. Each
call of inflate() or deflate() is limited to input and output chunks of the
maximum value that can be stored in the compiler's "unsigned int" type,
but there is no limit to the number of chunks. Note however that the
strm.total_in and strm_total_out counters may be limited to 4 GB. These
counters are provided as a convenience and are not used internally by
inflate() or deflate(). The application can easily set up its own counters
updated after each call of inflate() or deflate() to count beyond 4 GB.
compress() and uncompress() may be limited to 4 GB, since they operate
in a single call. gzseek() and gztell() may be limited to 4 GB depending on
how zlib is compiled. See the zlibCompileFlags() function in zlib.h.
The word "may" appears several times above since there is a 4 GB limit
only if the compiler's long type is 32 bits. If the compiler's long type is 64
bits, then the limit is 16 exabytes.
Greetings ... Kiffi
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Purebasic longs are signed [range : 0 - 2GB], so FileInfo\unCompressedSize is negative !
And I am verifying if FileInfo\unCompressedSize >= 0 ....
I have removed the test in this beta lib : http://people.freenet.de/gnozal/PureZIP_BETA.zip
Could you try it ?
REM : Of course the progression in PureZIP_SetCompressionCallback() will be false !
And I am verifying if FileInfo\unCompressedSize >= 0 ....
I have removed the test in this beta lib : http://people.freenet.de/gnozal/PureZIP_BETA.zip
Could you try it ?
REM : Of course the progression in PureZIP_SetCompressionCallback() will be false !
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
so now with PB4 you can use Quadsgnozal wrote:Purebasic longs are signed [range : 0 - 2GB], so FileInfo\unCompressedSize is negative !

now the file was extracted correctlygnozal wrote:Could you try it ?

yes, that's a pitty, because my progressbar doesn't work anymoregnozal wrote:REM : Of course the progression in PureZIP_SetCompressionCallback() will be false !

Thank you for your help!
Greetings ... Kiffi
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Yes, I think I will update the PB4.00 lib using quads.Kiffi wrote:so now with PB4 you can use Quadsgnozal wrote:Purebasic longs are signed [range : 0 - 2GB], so FileInfo\unCompressedSize is negative !
Kiffi wrote:now the file was extracted correctlygnozal wrote:Could you try it ?

It should be OK if I use quads.Kiffi wrote:yes, that's a pitty, because my progressbar doesn't work anymoregnozal wrote:REM : Of course the progression in PureZIP_SetCompressionCallback() will be false !![]()
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
I have added quads in this beta lib : http://people.freenet.de/gnozal/PureZIP_BETA.zip [Not tested]
Could you try it ?
It should :
- accept files up to 4 GB
- display correct progression for files > 2 GB
Could you try it ?
It should :
- accept files up to 4 GB
- display correct progression for files > 2 GB
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).