I am wondering if it’s possible to uncompress zip file to a memory block instead of to the disk. It appears that all of the methods regarding decompression are meant for writing to disk, not to memory.
are we supposed to do something like this:
ZipFile someFile("somePath.zip");
auto stream = someFile.createStreamForEntry(0); //create input stream from loaded zipfile
MemoryOutputStream mos;
mos.writeFromInputStream( *stream, stream->getTotalLength() ); //create an output stream
MemoryBlock mb( mos.getData(), mos.getDataSize() ); //write output stream to memoryBlock
String plainText = mb.toString(); //write memoryBlock to string object
Well, i’m retrieving some compressed strings from a server and am trying to decompress them without writing them to disk first. that’s where i’m having the difficulties.
Struggling to see what the problem is… ZipFile has a constructor that takes an input stream rather than a file, and you can read all the entries as streams, so there’s really no need to use files anywhere if you don’t want to.
i got it somewhat working when I switched to ZLIB_ENCODING_GZIP in the php and used Format::gzipFormat in Juce. I also had to pass in the known length of the decompressed string.