function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Unzip file from Apex?

I need to invoke a 3rd Party webservice that then returns to me the location of a Zip'd file from within which I need to extract the CSVs for processing.


Is there any suggested pattern for doing this? Would my only option be to transfer the Zip file to an intermediate server for unzipping, and then invoke a webservice hosted on that server tgo retrieve the contained CSVs? Thanks.




Unfortunately there are no utility methods in Apex to unzip files and although I suppose you could try to implement one yourself I wouldn't recommend it (having done exactly that in C many years ago!).  Your idea of an intermediate server sounds like a reasonable solution to me, if you can't get the original web service to generate the csvs in an unzipped form.



Pedro I Dal ColPedro I Dal Col
You can now do this natively in Apex using the open source Zippex library.