How to manage zip file
-
Hi,
What do you have in QBABufferOut ?
Are you sure it's opened correctly ?
Why do you needBufferIn
for ?And most important, what do you mean by
does not seem to work
? That's to vague to help you. -
Please have a look at this sequence:
QuaZipFile quaZip(QBABufferOut); // (rapresents a zip archivie in ram). if (quaZip.open(QIODevice::ReadOnly)) { // QIODevice::ReadOnly or someting else qDebug() << "ok"; } else qDebug() << "error"; // always error!!!!!!!!!!!!
-
You have to open the QuaZip for decompression first:
QBuffer storageBuff(&QBABufferOut); QuaZip zip(&storageBuff); if (!zip.open(QuaZip::mdUnzip)) qDebug() << "error"; QuaZipFile file(&zip); for (bool f = zip.goToFirstFile(); f; f = zip.goToNextFile()) { QuaZipFileInfo fileInfo; file.getFileInfo(&fileInfo); qDebug() << fileInfo.name; file.open(QIODevice::ReadOnly); qDebug() << "Content: " << file.readAll().toBase64(); file.close(); } zip.close();
P.S.
// (rapresents a zip archivie in ram).
No it doesn't. As mentioned before QuaZipFile represent a file inside a zip archive, not the archive itself
-
The only answer is zlib, you just need to decide the flavour
- QuaZIP (handles only .zip, wrapper around zlib)
- KArchive (supports multiple compression formats, for zip it's a wrapper on zlib)
- zlib if you don't mind C then you can use directly the reference library for zip files
I personally use KArchive because it's already conveniently wrapped in a Qt style and it can rely on the support of KDE
-
@VRonin said in How to manage zip file:
QuaZIP
Is there a license associated with the use of this? As I have a need for compressing large amounts of binary data that I need to transmit to remote clients.
@SPlatten said in How to manage zip file:
Is there a license associated with the use of this?
-
@SPlatten if both ends are in your software I'd suggest agains using 3rd party library. qCompress and qUncompress work just fine in that regard. My usual approach is to supply a header (using QDataStream) with checksum and whatever else is needed, then stream to it output from compression routine. Works sufficiently well, eliminates the need for another dependency.
-
@SPlatten if both ends are in your software I'd suggest agains using 3rd party library. qCompress and qUncompress work just fine in that regard. My usual approach is to supply a header (using QDataStream) with checksum and whatever else is needed, then stream to it output from compression routine. Works sufficiently well, eliminates the need for another dependency.
-
@mrdebug Which file works properly in this?
-
J jsulm referenced this topic on
-
J JonB referenced this topic on
-