Reputation: 1215
I am using the zlib to compress data but I need to create a valid gzip file with it in memory.
How do I correctly do that?
I need the file to be in memory but I'm not sure how to assemble it without writing to disk.
I have looked around but nothing clear cut stood out as a how to.
I know there's a gz_header but I'm not sure where the offset is in the file or how that's handled. Apparently there can be a trailer as well?
Upvotes: 3
Views: 990
Reputation: 12397
You can use Boost.Iostream with Gzip filters to compress data. You can adapt the example to use a memory stream instead of a file stream.
Upvotes: 3