FTP paging Support for miniunz


This is an enhancement to to the minunuz program which accompanies the zlib library. I was faced with the typical problem of downloading and unzipping a zip compressed file to the flash memory on an embedded system. The problem was that we did not have enough space to download the file on to flash and then unzip it and neither did we have enough memory in the system to cache the whole file in memory. So I implemented a LRU based paging scheme for ftp files in memory. You might find it useful in a memory/storage constrained environment. It also is a fast way to download a zip file from a FTP server without having to save it and then decompress it.

The features for the implementation are thus:

This simple implementation executes a new ioapi set for the  zlib mininunz implementation.

Usage:

The implementation is to be used for only mininuz. It does not zip and upload files to a remote directory.  The change implements a new ioapi set for mininuz. The additional files added are curl_adap.h, curl_adap_paging.h ioapi_url.c and curl_adap_paging.c. It has a few minimal changes incorporated into mininuz.c. The  patched version of unzip001.zip with complete makefiles is available. This patched version will produce the miniunz and minizip binaries. The miniunz binary will also accept ftp urls, also of the form ftp://username:password@ftpserver/filename as the file name to be unzipped. The behavior otherwise is the same as mininuz.

To configure the amount of dynamic memory to be used during runtime, configure the 2 constants in curl_adap_paging.h
CURL_ADAP_MAX_PAGES
CURL_ADAP_PAGE_SIZE
The default settings work fine for me. The largest file I have tried is a 35MB file.


Compatibility and Platforms:

This program has been tested on *nix platforms only. I do not know whether it will work on other platforms or not. However the implementation is in dialect free C and should not be much of a bother to port.
The implementation uses the following libraries and source code :
 

Files:



 

PS:

It would be great if you could drop a few lines across if you have found this thing useful/frustrating/buggy/useless to  me .