Syntax

$input.gzip()

Description

Compresses the given binary data using the GZIP compression format. The result is a binary value with content type application/gzip.

Parameters

Name Type Description Mandatory Default
input Binary data The binary data to be compressed. yes -
name String The name of the resulting binary value. no The name of the input with the suffix .gz appended.
level Number The compression level (0 for no compression up to 9 for best compression). no 9

Return value

type: Binary data

The GZIP-compressed contents of the input.

Example

binary(name: "hello.txt", data: "Hello world!", encoding: "utf-8").gzip()

Returns a binary value named "hello.txt.gz" containing the compressed contents of the text file.