koriolis.zipstream: Functions Types Modinfo Source  

Zip stream support (read-only)

This module adds two new stream protocols for zip support in streams : "zip" and "zip?"
"zip" is for reading files that are in the specified zip.
"zip?" is for reading files that are in the specified zip OR (if not found in the zip) on the hard drive (or any other location supported by streams).

The zip stream works over another stream. This means that you can not only access zip files on the hard drive, but also zp files that are incbined, or even zip files within other zip files, and so on.

Example of valid urls: "zip::myGame/myZip.zip//someFile.txt", or even "zip::incbin::myGame/myZip.zip//someFile.txt" if the zip file is incbined.

So you could do by example: LoadText("zip::myGame/myZip.zip//someFile.txt")

In the previous version of this module, TZipStream was not seekable. It is now entirely seekable, and will thus work with any underlying stream.

Functions Summary

ClearZipStreamPassword Clears a password for a given zip file.
SetZipStreamPassword Registers a password for a given zip file. Must be done before attempting to read any password protected zip file (or else, a TZipStreamReadException is thrown)

Types Summary

TZipStreamReadException This exception is thrown in the event of read error in a zip file.

Functions

Function ClearZipStreamPassword(zipUrl$)
DescriptionClears a password for a given zip file.

Function SetZipStreamPassword(zipUrl$, password$)
DescriptionRegisters a password for a given zip file. Must be done before attempting to read any password protected zip file (or else, a TZipStreamReadException is thrown)

Types

Type TZipStreamReadException Extends TStreamReadException
DescriptionThis exception is thrown in the event of read error in a zip file.

Module Information

Version1.0.3
AuthorRégis JEAN-GILLES (Koriolis)
LicensePublic Domain
CreditThis mod makes use if the ZLib C functions by Gilles Vollant (http://www.winimage.com/zLibDll/unzip.html), with tidbits from the ZipEngine module by gman)
History1.0.3 Fixed crash when attempting to close an already closed ZipStream. Corrected misspell in SetZipStreamPassword and ClearZipStreamPassword (but also kept misspelled version for backward compatibility).
History1.0.2 ZipStream now seekable. The raw Seek method uses simple brute force (restarts from the beginning of the file) but the stream is now wrapped with a a TBufferedStream, amortizing any potential inefficiency