How to unzip a file in script

cborkert
Giga Contributor

An external service is sending a text file to ServiceNow, this is being received with a custom processor.

 

The file contents (HTTP POST body) text is easily read using:

var data = GlideStringUtil.getStringFromStream(g_request.getInputStream());

 

They are sending a ZIP file however, which needs to be decompressed.   Is there some script that will do this?   I've looked into ZipImportStream, but not sure how to get the bytes inflated.

 

Thanks,

5 REPLIES 5

ck_phenix
Kilo Expert

Hi Chris,



I think it is possible with ZipEntry and ZipInputStream java packages. Can you give more details? What will be the content of zip file?



Thanks,


CK


cborkert
Giga Contributor

It's a single XML file inside the ZIP file.   Thanks,


Harish Murikina
Tera Guru

Check this it may helps you.


javascript - Unzipping files - Stack Overflow


Michael Domke
Tera Guru

Did you ever find a solution for this. I have a similar interest.



Michael