<file:read path="file.txt"/>
<compression:compress>
   <compression:compressor>
       <compression:gzip-compressor/>
   </compression:compressor>
</compression:compress>
<file:write path="file-txt.gz"/>
Compress and Decompress Example
The following Compression module examples show how to compress a file using the Compress operation and decompress a payload from a remote service using the Decompress operation.
Compress a File
In the following example, you configure the File Connector Read operation to read a file. Then, the Compress operation compresses the file and saves it in GZip format. Subsequently, the File Connector Write operation writes the content into the given path on demand.
- 
In Studio, drag the File Connector Read operation to your flow.
 - 
Set Path to
file.txt. - 
Drag the Compress operation alongside the Read operation.
 - 
Set Compressor to Gzip compressor
 - 
Drag the Write operation alongside the Compress operation.
 - 
Set Path to
file-txt.gz. 
In the Configuration XML editor, the configuration looks like this:
Decompress a Payload from a Remote Service
In the following example, you configure the Web Service Consumer Connector Consume operation to consume an operation that returns a Zip file from a server. Then, the Decompress operation decompresses the Zip file.
- 
In Studio, drag the Web Service Consumer Connector Consume operation to your flow.
 - 
Set Connector configuration to your operation configuration, for example
ZipServiceConfig. - 
Set Operation to the name of the web service operation to invoke, for example
returnsZip. - 
Drag the Decompress operation alongside the Consume operation.
 - 
Set Content to
payload.body.zipContent. - 
Set Compressor to Zip compressor.
 
In the Configuration XML editor, the configuration looks like this:
<compression:decompress doc:name="Decompress" >
 <compression:compressed ><![CDATA[#[payload.body.zipContent]]]></compression:compressed>
    <compression:decompressor >
   <compression:gzip-decompressor />
</compression:decompressor>
</compression:decompress>



