Nav

Compression Module

The Compression module provides functionality for handling compressed data.

Compressing data

The zip operation compresses data using the ZIP format.

Actual compression will occur in a lazy manner. This operation returns a stream and actual compression will happen as the stream is consumed. Keep in mind that any errors that may rise during compression will not occur in this operation, but in those which are consuming the stream returned here.

The following example will compress the current message payload:


         
      
1
<compression:zip />

You can also use embedded DataWeave transformations to compress a custom content:


         
      
1
2
3
4
5
<compression:zip>
    <compression:content>
        #[payload.userData.image]
    </compression:content>
</compression:zip>

Decompressing data

The unzip operation decompresses data using the ZIP format.

Actual compression will occur in a lazy manner. This operation returns a stream and actual decompression will happen as the stream is consumed. Keep in mind that not all errors that may rise during compression will occur in this operation. Some might actual appear in the components that consume this stream

The following example will decompress the current message payload:


         
      
1
<compression:unzip />

You can also use embedded DataWeave transformations to compress a custom content:


         
      
1
2
3
4
5
<compression:unzip>
    <compression:content>
        #[payload.userData.compressedImage]
    </compression:content>
</compression:unzip>

Adding the module to your project

To use the FTPS module, you simply add it to your Mule app through the Studio or Flow Designer UI, or you can add the following dependency in your pom.xml file:


         
      
1
2
3
4
5
6
<dependency>
    <groupId>org.mule.modules</groupId>
    <artifactId>mule-compression-module</artifactId>
    <version>1.0.0</version> <!-- or newer -->
    <classifier>mule-plugin</classifier>
</dependency>

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.

+