Compression Module - Mule 4
home
The Compression module provides functionality for handling compressed data.
Compressing Data
The zip
operation compresses data using the ZIP format.
Actual compression occurs in a lazy manner. This operation returns a stream and actual compression happens as the stream is consumed. Any errors that may rise during compression do not occur in this operation, but in those which are consuming the returned stream.
The following example will compress the current message payload:
<compression:zip />
You can also use embedded DataWeave transformations to compress a custom content:
<compression:zip>
<compression:content>
#[payload.userData.image]
</compression:content>
</compression:zip>
Decompressing data
The unzip
operation decompresses data using the ZIP format.
Actual decompression occurs in a lazy manner. This operation returns a stream and actual decompression will happen as the stream is consumed. 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:
<compression:unzip />
You can also use embedded DataWeave transformations to compress a custom content:
<compression:unzip>
<compression:content>
#[payload.userData.compressedImage]
</compression:content>
</compression:unzip>