Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Text.ZLibCompress

Compresses the given data using lib.

Component Version macOS Windows Linux Server iOS SDK
Text 15.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Text.ZLibCompress"; Input; InputEncoding; OutputEncoding { ; FileName; Flags } )   More

Parameters

Parameter Description Example Flags
Input The input.
Can be a container value or text.
"Hello World"
InputEncoding The input encoding.
e.g. UTF-8, Hex, Base64.

The default for text is UTF-8.
"UTF-8"
OutputEncoding How to package the output.
Can be Hex, Base64 or Container.
"Base64"
FileName For a container as output the file name to use. "compressed.zip" Optional
Flags Pass 1 for raw compression. Optional

Result

Returns data or error.

Description

Compresses the given data using lib.
Can optional do raw zlib without header and checksum.

If you implement TarDoc in the Swiss, you need the raw option.

Examples

Compress some text:

MBS( "Text.ZLibCompress"; "Hello Hello World Hello"; "UTF-8"; "Base64")

Example result: eNrzSM3JyVfwAJPh+UU5KRA2AGH1CEU=

Compress some text with raw:

MBS( "Text.ZLibCompress"; "Hello Hello World Hello"; "UTF-8"; "Base64"; ""; 1)

Compress and decompress with containers:

Let([
    // compress a container with a RTF file
    c = MBS( "Text.ZLibCompress"; MyDatabase::ContainerField; ""; "Base64" );

    // decompress it again and put it back in container
    d = MBS( "Text.ZLibDecompress"; c; "Base64"; "Container"; "test.rtf" )
]; d)

See also

Release notes

  • Version 15.5
    • Added Text.ZLibCompress and Text.ZLibDecompress functions.

Blog Entries

This function checks for a license.

Created 9th October 2025, last changed 11st October 2025


Text.WriteToContainer - Text.ZLibDecompress