Contact Us 1-800-596-4880

Compression Module Reference - Mule 4

Compression Module v2.2

A module which provides functionality for compressing and decompressing data.

Configurations


Config

Default configuration

Parameters

Name Type Description Default Value Required

Name

String

The name for this configuration. Connectors reference the configuration with this name.

x

Operations

Archive

<compression:archive>

Compresses all the given entries into a new file in the configured format.

Each entry passed to this operation is placed inside the compressed archive with the entry name you provide in the DataWeave script. For example, for the following expression:

{ file: vars.aTxtContent, 'dir/resume.pdf': vars.pdf }

The resultant archive contains two entries: file, located at the root level, and resume.pdf, located in the dir directory.

+- Archive | \- file1 | \+ dir1 | \- file2

In this example, the slash / in the name of an entry indicates a directory separation. All names create directories inside the archive.

Parameters

Name Type Description Default Value Required

Entries

Object

Entries to add to the archive file.

#[payload]

Archiver

Archiver strategy that compresses multiple entries into an archive.

x

Output Mime Type

String

MIME type of the payload that this operation outputs.

Output Encoding

String

Encoding of the payload that this operation outputs.

Streaming Strategy

Configures how Mule processes streams. Repeatable streams are the default behavior.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Output

Type

Binary

Throws

  • COMPRESSION:COULD_NOT_COMPRESS

Compress

<compression:compress>

Compresses a given content using the configured format Zip or GZip.

Parameters

Name Type Description Default Value Required

Content

Binary

Content to compress.

#[payload]

Compressor

One of:

Compressor strategy that compresses a file or a single-entry archive.

x

Output Mime Type

String

MIME type of the payload that this operation outputs.

Output Encoding

String

Encoding of the payload that this operation outputs.

Streaming Strategy

Configures how Mule processes streams. Repeatable streams are the default behavior.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Output

Type

Binary

Throws

  • COMPRESSION:COULD_NOT_COMPRESS

Decompress

<compression:decompress>

Decompresses a single entry of compressed content in the configured format of Zip or GZip. Compressed archives can have multiple entries. The Decompress operation manages only single-entry archives because if the archive contains more than one entry, the operation does not know which entry to return. For multiple entry archives, use this module’s Extract operation, which enables you to select only formats that accept multiple entries.

Parameters

Name Type Description Default Value Required

Compressed

Binary

Content to decompress.

#[payload]

Decompressor

One of:

  • gzip-decompressor

  • zip-decompressor

Decompressor strategy that decompress a file or a single-entry archive.

x

Output Mime Type

String

MIME type of the payload that this operation outputs.

Output Encoding

String

Encoding of the payload that this operation outputs.

Streaming Strategy

Configures how Mule processes streams. Repeatable streams are the default behavior.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Output

Type

Binary

Throws

  • COMPRESSION:COULD_NOT_DECOMPRESS

  • COMPRESSION:INVALID_ARCHIVE

  • COMPRESSION:TOO_MANY_ENTRIES

Extract

<compression:extract>

Decompresses a given content that represent an archive in a compression format.

Parameters

Name Type Description Default Value Required

Compressed

Binary

Compressed archive content to decompress.

#[payload]

Extractor

One of:

  • zip-extractor

Extractor strategy that decompresses an archive with multiple entries that are compressed in a particular format.

x

Streaming Strategy

Configures how Mule processes streams. Repeatable streams are the default behavior.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The expression outcome is stored in the target variable.

#[payload]

Output

Type

Object

Throws

  • COMPRESSION:COULD_NOT_DECOMPRESS

  • COMPRESSION:INVALID_ARCHIVE

Types

Repeatable In Memory Stream

Field Type Description Default Value Required

Initial Buffer Size

Number

This is the amount of memory to allocate to consume the stream and provide random access to it. If the stream contains more data than can fit into this buffer, then the buffer expands according to the bufferSizeIncrement attribute, with an upper limit of maxInMemorySize.

Buffer Size Increment

Number

This is by how much the buffer size expands if it exceeds its initial size. Setting a value of zero or lower will mean that the buffer should not expand, meaning that a STREAM_MAXIMUM_SIZE_EXCEEDED error will be raised when the buffer gets full.

Max Buffer Size

Number

This is the maximum amount of memory that will be used. If more than that is used then a STREAM_MAXIMUM_SIZE_EXCEEDED error will be raised. A value lower or equal to zero means no limit.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

The unit in which all these attributes are expressed

Repeatable File Store Stream

Field Type Description Default Value Required

Max In Memory Size

Number

Defines the maximum memory that the stream should use to keep data in memory. If more than that is consumed then it will start to buffer the content on disk.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

The unit in which maxInMemorySize is expressed

Non-repeatable Stream

Disables the repeatable stream functionality and uses non-repeatable streams to have less performance overhead, memory use, and cost.

Zip Compressor

Field Type Description Default Value Required

Force Zip64

Boolean

Enables you to compress files and byte arrays greater than 4 GB.

false

Zip Archiver

Field Type Description Default Value Required

Force Zip64

Boolean

Enables you to archive files and byte arrays greater than 4 GB.

false

View on GitHub