Text.ZLibCompress
-----------------

Compresses the given data using lib.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Text](component_Text.md) | [15.5](newinversion155.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Text.ZLibCompress"; Input; InputEncoding; OutputEncoding { ; FileName; Flags } ) 

**MBS**( **"Text.ZLibCompress";** /\* Compresses the given data using lib. \*/  
**$Input**; /\* The input.   
Can be a container value or text.e.g. "Hello World" \*/   
**$InputEncoding**; /\* The input encoding.  
e.g. UTF-8, Hex, Base64.  
  
The default for text is UTF-8.e.g. "UTF-8" \*/   
**$OutputEncoding**; /\* How to package the output.  
Can be Hex, Base64 or Container.e.g. "Base64" \*/   
**$FileName**; /\* Optional; For a container as output the file name to use.e.g. "compressed.zip" \*/   
**$Flags**) /\* Optional; Pass 1 for raw compression. \*/ 

### 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 (Swiss medical billing standards for 2026), you need the raw option.  
### Examples

Compress some text:

 MBS ( "Text.ZLibCompress"; "Hello Hello World Hello"; "UTF-8"; "Base64")  
<small>  
Example result: eNrzSM3JyVfwAJPh+UU5KRA2AGH1CEU=</small>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](TextZLibDecompress.md)"; c; "Base64"; "Container"; "test.rtf" )  
\]; d)  
### See also

- [Text.ZLibDecompress](TextZLibDecompress.md)

### Release notes

- **Version 15.5**
    - Added [Text.ZLibCompress](https://www.mbsplugins.eu/TextZLibCompress.shtml) and [Text.ZLibDecompress](https://www.mbsplugins.eu/TextZLibDecompress.shtml) functions.

### Blog Entries

- [New in MBS FileMaker Plugin 15.5](https://www.mbsplugins.de/archive/2025-11-25/New_in_MBS_FileMaker_Plugin_15/monkeybreadsoftware_blog_filemaker)
- [Neues MBS Plugin 15.5 für Claris FileMaker](https://www.mbsplugins.de/archive/2025-11-18/Neues_MBS_Plugin_155_für_Clar/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin 15.5 for Claris FileMaker](https://www.mbsplugins.de/archive/2025-11-18/MBS_Plugin_155_for_Claris_File/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 15.5pr3](https://www.mbsplugins.de/archive/2025-10-13/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 9th October 2025 , last changed 28th January 2026

  
[Text.WriteToContainer](TextWriteToContainer.md) - [Text.ZLibDecompress](TextZLibDecompress.md)

[HTML Version](TextZLibCompress.shtml)