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 test2 = zipencode(test)
string test3 = zipdecode(test2)
print test3
or
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:
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:
Project Details
Project CVS: | http://svn.igorexchange.com/viewvc/packages/ZIP/ |
Current Project Release
Release File: | ZIP.zip (173.63 KB) |
Version: | IGOR.8.00.x-1.0-0 |
Version Date: | |
Version Major: | 8 |
Version Extra: | 0 |
Version Patch Level: | 0 |
OS Compatibility: | Windows Mac-Intel |
Release Notes: |
For Igor Pro 8 |
Forum
Support
Gallery
Igor Pro 9
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More