Compressing and Decompressing a Single File
The Compression module provides the Compress and Decompress operations that enable you to compress or decompress a single file in the configured Gzip or Zip format.
Configure Compress Operation
Given an input stream payload, the Compress operation enables you to compress the stream and return a new compressed stream of bits. You can then store the compressed stream of bits in a file system or transfer it to another system.
-
In Studio, drag the Compress operation to your flow.
-
Set Content to your input stream payload to compress.
-
Set Compressor to Gzip compressor or Zip compressor strategy.
In the Configuration XML editor, the configuration looks like this:
<compression:compress>
<compression:content>#[payload.data]</compression:content>
<compression:compressor>
<compression:zip-compressor/>
</compression:compressor>
</compression:compress>
Configure GZip Compressor Strategy
A compressor strategy compresses a file or a single-entry archive. The Gzip compressor strategy declares that the content must be compressed in the Gzip format.
-
In Studio, select the Compress operation from your flow.
-
Set Compressor to Gzip compressor.
In the Configuration XML editor, the configuration looks like this:
<compression:compress doc:name="Compress">
<compression:compressor >
<compression:gzip-compressor/>
</compression:compressor>
</compression:compress>
Configure Zip Compressor Strategy
The Zip compressor *strategy declares that the content must be compressed in the Zip format.
-
In Studio, select the Compress operation from your flow.
-
Set Compressor to Zip compressor.
-
Select Force ZIP64 to compress files and byte arrays greater than 4 GBs.
In the Configuration XML editor, the configuration looks like this:
<compression:compress doc:name="Compress">
<compression:compressor >
<compression:zip-compressor forceZip64="true"/>
</compression:compressor>
</compression:compress>
Configure Decompress Operation
The Decompress operation enables you to decompress a single-entry compressed content, which is an archive in a specified compression format. Compressed archives can have multiple entries, but this operation manages only single entry archives because if the archive contains more than one entry, the operation does not know which to return. For multiple entry archives, use the Extract operation, which enables you to choose only formats that accept multiple entries.
-
In Studio, drag the Decompress operation to your flow.
-
Set Compressed to your input stream payload to decompress.
-
Set Decompressor to Gzip decompressor or Zip decompressor strategy.
In the Configuration XML editor, the configuration looks like this:
<compression:decompress>
<compression:content>#[payload]</compression:content>
<compression:decompressor>
<compression:gzip-decompressor/>
</compression:decompressor>
</compression:decompress>
Configure GZip Decompressor Strategy
A decompressor strategy decompress a file or a single-entry archive. The Gzip decompressor strategy declares that the content must be decompressed with the Gzip format.
-
In Studio, select the Decompress operation from your flow.
-
Set Decompressor to Gzip decompressor.
In the Configuration XML editor, the configuration looks like this:
<compression:decompress doc:name="Decompress" >
<compression:decompressor >
<compression:gzip-decompressor />
</compression:decompressor>
</compression:decompress>
Configure Zip Decompressor Strategy
The Zip decompressor strategy declares that the content must be decompressed with the Zip format.
-
In Studio, select the Decompress operation from your flow.
-
Set Decompressor to Zip decompressor.
In the Configuration XML editor, the configuration looks like this:
<compression:decompress doc:name="Decompress" >
<compression:decompressor >
<compression:zip-decompressor />
</compression:decompressor>
</compression:decompress>