cancel
Showing results for 
Search instead for 
Did you mean: 

How to Unzip a zip file in memory?

SGoel.2
Associate III

I am writing a program to unzip a zip file downloaded from cloud in memory by itself if it seem any zip file available in memory but I am not getting any small & simple library to implement it.

Can anyone help me regarding this?

5 REPLIES 5
Pavel A.
Evangelist III

Depends on how you define small and simple, and which compression methods are in use.

One can find helpers to do tedious work for them.

Actually I have seen libzip library but it was very complex i.e. I am asking about easy library which will easy to understand.

If you have not found a "easy" library after sufficient googling, maybe it does not exist?

Can you consider other (simpler) compressed format, for example this?

Or delegate this chore to somebody else and just use the result.

Seem to recall Mark Adler publishing a code example of Inflate in the early 1990's. Phil Katz also documented his algorithms, and I've written code based on those.

https://github.com/madler/zlib/blob/master/inflate.c

Most of this stuff ends up being non-trivial, and things which are simple (to use) tend to involve a lot of actual work. A lot of code either expects to be working with a file-system, or infinite supplies of RAM, things which MCU embedded tends not to have.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

These libraries usually have embedded-friendly decompression mode that streams the data to RAM buffers, without any dependency on files. For example, the EmWin PNG add-on includes this stuff to decompress PNG images.

But the zip format actually is a container that can hold items compressed in different ways (or not compressed at all). Locating items in the zip is a bonus task )) Also, zipped items can be encrypted - yet another bonus.