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.
Comments
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.
zip ≠ gzip
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
kill ^dbg
set s=##class(%Stream.FileBinaryGzip).%New()
do s.LinkToFile("1.xml")
do $System.OBJ.LoadStream(s)
write ^dbg
>123Hope 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.
Thanks,
Arun Kumar Durairaj.
Here's an example unarchiver.
$zf(-100) can be used to call arbitrary executables, such as 7zip.
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: https://stackoverflow.com/a/3451150/345422
import zipfile
with zipfile.ZipFile(pZipFileName, 'r') as zip_ref:
zip_ref.extractall(pExtractToDir)
}
Or
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