GZIP
Compresses a single file with gzip and returns the compressed binary data. The input must be text, so convert objects with TO_JSON first.
Categories: Data Parsing/Conversion
Syntax
GZIP(file_contents)
Examples
Example 1: The output is binary, so encode it with BASE64_ENCODE to read or send it as text
Input
1
{
2
"my_action": {
3
"text": "hello world"
4
}
5
}
Formula
BASE64_ENCODE(GZIP(my_action.text))
Output
"H4sIAAAAAAAAA8tIzcnJVyjPL8pJAQCFEUoNCwAAAA=="
Example 2: Convert objects to text with TO_JSON before compressing them
Input
1
{
2
"my_action": {
3
"data": {
4
"foo": "bar"
5
}
6
}
7
}
Formula
BASE64_ENCODE(GZIP(TO_JSON(my_action.data)))
Output
"H4sIAAAAAAAAA6tWSsvPV7JSSkosUqoFAO/1K/4NAAAA"
Example 3: Decompress with GUNZIP
Input
1
{
2
"my_action": {
3
"text": "hello world"
4
}
5
}
Formula
GUNZIP(GZIP(my_action.text))
Output
"hello world"