ZIP - inflating and deflating strings and files using zlib and minizip

This XOP is able to inflate and deflate strings and unzip zip archives.

The deflation and inflation of strings is encoded in .z and .gz formats. You can use this to compress strings (or any other data) inside IGOR. By using fbinread you can also zip individual files.

You can also unzip zip archives that contain multiple files.

ZIP is based on the free zlib library (www.zlib.net) and the Minizip code by Gilles Vollant (http://www.winimage.com/zLibDll/minizip.html)

Useage:
string test = "0123456789"
string test2 = zipencode(test)
string test3 = zipdecode(test2)
print test3


or
variable fileID
open/r fileID      //open a .gz file
fStatus fileID    //get the length of the file in bytes
string inData = ""
inData = padstring(indata,V_logEOF,0)   //make the indata string as long as the fileitself
fbinread fileiD, inData //read in the data
string unzippedData = zipdecode(inData)   //unzip the data in the string
close(fileID)


This can be useful for zipping and unzipping waves using the SOCKIT.xop. (This has commands SOCKITstringtoWave and SOCKITwavetostring).

To unzip zip archives use the following code:
ZIPfile/o outputDirStr, sourceZipfileStr

The /O flag means that files extracted from the sourceZipfile will overwrite those already contained in the outputDirectory.
outputDirStr is a string containing the directory location for the extracted files.
sourceZipfileStr is a string containing the location of the zip archive.
Both outputDirStr and sourceZipfileStr must be native file paths, i.e. NOT POSIX.
In addition, all directory structure from the zip file will be lost/flattened.
for example:
ZIPfile/o "Macintosh HD:Users:joe:Desktop:", "Macintosh HD:Users:joe:Desktop:data.zip"

Project Details

Project CVS: http://svn.igorexchange.com/viewvc/packages/ZIP/

Current Project Release

ZIP - inflating and deflating strings and files using zlib and minizip IGOR.7.00.x-7.0-0

Release File: ZIP.zip
Version: IGOR.7.00.x-7.0-0
Version Date: Tue, 11/01/2016 - 06:55 pm
Version Major: 7
Version Patch Level: 0
OS Compatibility: Mac-Intel Windows
Release Notes: Targets IP7 only. 64 bit Windows and OSX XOP's are available.
View All Releases

Forum

Support

Gallery

Igor Pro 8

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More