Libarchive: how to compress an archive on windows? - c++

I am trying to create a compressed archive on windows with libarchive and at the moment it is not working. I can create zip or pax_restricted(tar) archives without compression, without any problems.
To add compression I've tried some combinations of the following:
archive_write_set_compression_lzip(lWriteArchive);
archive_write_add_filter_lzip(lWriteArchive);
archive_write_set_compression_gzip(lWriteArchive);
archive_write_add_filter_gzip(lWriteArchive);
archive_write_set_format_zip(lWriteArchive);
archive_write_set_format_pax_restricted(lWriteArchive);
I've mainly tried using lzip compression with the zip format and gzip compression with the pax_restricted format.
First I'm not sure whether I should use archive_write_set_compression_* or archive_write_add_filter_*.
When I try add lzip compression and I step into the function I see it returns ARCHIVE_FATAL with the error message "lzma compression not supported on this platform".
When I try to add gzip compression and I step into the function I see it returns ARCHIVE_WARN with the error message "Using external gzip program". If I let the process go on the resulting archive has a size of zero.
I get the feeling like on unix systems there are system libraries for lzma and gzip that libarchive uses for compression and that these are not available on windows.
I built libarchive using the latest stable release, following the the instructions to use CMake etc. I didn't notice any errors in the CMake configuration like I was missing lzma or gzip.
Thanks for any help.

Related

Quazip too many files

I'm having a problem with QuaZip.
I have a program that extracts files from zip archives. The unzip library I was using hadn't been maintained in about 10 years and had problems with the archive contained more than about 65000 files, so I converted my program to use QuaZip.
It turns out that QuaZip has the same problem. I have an archive that 7-Zip shows has 67946 objects. QuaZip only sees 2397 files. ZipInfo also shows only 2397 files. It appears that these tools have not been updated for the newer zip64 format, although QuaZip does seem to use QuaZipFileInfo64 which presumably is there to support the ZIP64 format. Also, Wikipedia documents QuaZip as supporting the new format.
Calling getEntriesCount() for the quazip object returns 2397.
Using the JlCompress::getFileList code to get the list of files only returns 2397.
Not 100 percent sure what I am asking. Does QuaZip support more than 65500 files in an archive? If so, is there a reason why it would be acting as if it doesn't?
As I suspected in my last comment, the number of entries field in the central directory header is incorrect having overflowed on the creation. The solution I came up with was to remove the code in unzGoToNextFile that assumes that that entry is correct.

error regarding ffmpeg while using python to access a wav file

When I used python audio segment to open a .wav file and divide it into many .wav files i am getting this error
"C:\Python27\lib\site-packages\pydub\utils.py:165: RuntimeWarning: Couldn't find
ffmpeg or avconv - defaulting to ffmpeg, but may not work
warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work"
, RuntimeWarning)"
It seems like you don't have ffmpeg, which is listed in the dependencies section of the Pydub GitHub. However, it is only required if you wish to load or save non-WAV files.
This message is just a warning, if you're using Pydub solely for WAV files, it is safe to simply ignore it.

Create a zip archive in c++

Is there a way to create a zip archive with the full folder content or multi-files.
I actually looked the example on the web but each time it's a compression of file only based on a buffer like for example : gzip_compressor() or gzwrite()
I can't give a full path in input but only a file buffer.
=> Then no folder compression nor multi-file compression ???
Please note that I would like to use zlib/gzip or boost (the only library i can link)
I think I missed something there...
Can you please help me ?
Marc.
There are several libraries out there to handle zip files. They use zlib for the compression, decompression, and crc32 operations. You should look at libzip and DotNetZip.
It looks like this will work. If you are on a Unix environment you may have to run the Java version:
http://www.7-zip.org/sdk.html

Good free lib for compression

I need compress library for following needs:
1) Packing directory in one file with extension of my choice ( .pack for example )
2) Work with content in this file (directory) without unpaking it
3) Mechanism for encrypting
I already know about zlib, but for me it is ugly documented and not written anywhere what features are support from it
Packing directory in one file with extension of my choice ( .pack for example )
Most archivers don't require you to use a particular file extension. Regardless, one can still invoke file on a file to guess its content type.
Work with content in this file (directory) without unpaking it
It's possible to create a file list manually and prepend any archive file with that. Often, .sh installers for Linux contain a shell script in the beginning, followed by some magic line like __ARCHIVE_START__ followed by a binary archive. Hence it is possible to read lines from a file until __ARCHIVE_START__ line has been read. The rest of the file is an archive file.
Mechanism for encrypting
One easy way is to use different libraries for archiving and encrypting:
Bundle the files into one .tar.
Archive .tar into say .tar.xz.
Prepend the .tar.xz with file list followed by __ARCHIVE_START__ line.
Encrypt the file with any encryption library you please.
What you want is not a compression library. You want a compression, archiving, and encryption library or libraries. You need archiving to put a directory of files into a single file.
You can use zlib to do the compress part, but not archive or encrypt. zlib is documented in zlib.h and you can see a usage example there, as well as many examples in the source distribution package.
You can construct your own archiving format, or you can use existing ones for which there are libraries such as zip or tar, both of which use or can be directed to use zlib.
You can use OpenSSL for strong encryption.

7zip file compression mode store using command prompt is not working?

I need to compress my data folder using 7zip (compression mode store) from my nant script. If I compressed from command prompt its not working properly. It taking some other compression mode.
This is my code
7zip.exe a mydatafolder.7z -ptest -mx0 mytarget
Please help me.
Thanks
Which version of 7zip.exe?
Which compression mode is used in the existing 7z file?
Can you attach\link to a sample 7z archive that you have tried and behaves unexpectedly when trying to add another file without compression?
I am not sure if you can use mixed compression mode in a 7z archive or not.