Gzip V2 zips a JSON or a text as a string in base64 or file. With it, it's also possible to compress and decompress files in gzip format. This version of the component supports Double Braces. To understand how this language works, read our article by clicking here.

Take a look at the configuration parameters of the component:

  • Operation: "compress_fields" compresses the fields of a JSON; "decompress_fields" decompresses the files of a JSON; "compress_payload" compresses a received payload; "decompress_payload" decompresses a received payload; "compress_file" compresses a received file; "decompress_file" decompresses a received file.
  • JSON Field: JSON path to be compressed or decompressed, considering the fields must be separated by comma (eg.: field1,field2).
  • Preserve Original: if activated, the option preserved the original fields that have prefix with underline.
  • Binary Content: if activated, the option makes the data to be treated as binary and a base64 string is expected.
  • Payload: this field is valid for the “compress_payload” and “decompress_payload” operations only and declares what will be compressed/decompressed in the request.
  • Result As File: if activated, the option will save the result of the compression or decompression in a file (valid for the “compress_payload” and “decompress_payload” operations only).
  • File Name: name of the file to be compressed.
  • Gzip File Name: name of the file in gzip format.
  • Fail On Error: if "true", the pipeline with error execution will be suspended; if "false", the pipeline execution continues, but the result will show a false value for the success property.

Messages flow

Input

For the “compress_fields” and “decompress_fields” operations, the component is expected to receive a JSON with the fields configured in the JSON Field property.

Example

  • Configuring:
JSON Field = field1,field2

The expected JSON must at least have:

{
"field1": "SOMETHING",
"field2": "SOMETHING"
}

For the “compress_payload” and “decompress_payload” operations, you must configure the “Payload” field to make the compression/decompression.

Example

Payload = {{ message.field1 }}

The JSON must have this value:

{
"field1": "SOMETHING"
}

For the “compress_file” and “decompress_file” operations, you must configure the file to be compressed/decompressed and the resulting file of this operation.

Example

File Name = file.csv

Gzip File Name = file.gzip

Output

For the “compress_fields” and “decompress_fields” operations, the input message is preserved.

For the “compress_payload” and “decompress_payload” operations, if the output is a file:

{
"success": "true",
"fileName": "file.csv"
}

For the "compress_payload” and “decompress_payload” operations, if the output is a string:

{
"success": "true",
"result": "SOMETHING COMPRESSED/DECOMPRESSED"
}

For the “compress_file” and “decompress_file” operations:

{
"success": "true",
"fileName": "file.csv",
"gzipFileName": "file.csv"
}

Did this answer your question?