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
joneilljoneill 

How to unzip a zipfile attachment in apex and process each file in the zip attachment

I have a requirement from a client to process an email via Email Services.  Unfortunately the attachment is a zip XML file.  Is there a way to unzip a file or read the file within the zip file using APEX code?
Sagar PareekSagar Pareek
Answers is NO you cannot .

This seems to be existing problem with apex 

https://developer.salesforce.com/forums/ForumsMain?id=906F00000008xUVIAY

https://developer.salesforce.com/forums/ForumsMain?id=906F00000008z5fIAA



 
joneilljoneill
Do you have any good work arounds?  Like a middle ware that can extract the zip and send it to Salesforce.  Thanks in advance!
Pedro I Dal ColPedro I Dal Col
You can do this natively in Apex using the Zippex library which is open source. https://github.com/pdalcol/Zippex
Helton Carlos de MouraHelton Carlos de Moura

Hi! Good afternoon. I need some help. I have a class of apex that sends data to a webservice and it returns me a string. Except that this string returned me zipped (deflate). I need to know a way to extract it. I saw things about the inflate, but I could not use it. Help?