Vineeth Jagannathan · May 25, 2017

Can we pull .zip file using webservice call into ensemble and unzip it

I need to pull .zip file and unzip it to access the zip files contained in the archive using the web service call. Can any one suggest is there any option for to get the zip files.

0 1,018
Discussion (7)4
Log in or sign up to continue


do $zf(-1,"pkzipc.exe -extr -over=all [and etc.]")

Instead of pkzip, you can use 7z, rar, gzip32 etc.

Thanks for the info. $zf is the command to unzip the files.

Hi, Vineeth!

See the sample of exporting and importing global to zip file on the fly from @Eduard Lebedyuk post:

set ^dbg=123
set s=##class(%Stream.FileBinaryGzip).%New()
do s.LinkToFile("1.xml")
do $System.OBJ.ExportToStream("dbg*.GBL", s)
do s.%Save()
kill ^dbg
set s=##class(%Stream.FileBinaryGzip).%New()
do s.LinkToFile("1.xml")
do $System.OBJ.LoadStream(s)
write ^dbg

Hope that helps.

Hi All,

I want to unzip the text files or any format (more than 50) from sFTP in windows server by using Intersystems IRIS. Can you please advise on this. 


Arun Kumar Durairaj. 

For those who are looking for unziping features, Embedded Python (for IRIS 2021.2+) allows you to use zipfile Python lib. For instance:

ClassMethod UnZip(pZipFileName As %String, pExtractToDir As %String) [ Language = python ]
    #; solution based on this one:
    import zipfile
    with zipfile.ZipFile(pZipFileName, 'r') as zip_ref:


ClassMethod UnZip2(pZipFileName As %String, pExtractToDir As %String)
    Set zipfile = $SYSTEM.Python.Import("zipfile")
    Do zipfile.ZipFile(pZipFileName, "r").extractall(pExtractToDir)

Tested on iris-ml-community:2021.2.0.617.0-zpm