Archive.GZipDecompress
----------------------

Extracts content of gzip file as container.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Archive](component_Archive.md) | [11.3](newinversion113.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Archive.GZipDecompress"; Archive { ; New file name; Options } ) 

**MBS**( **"Archive.GZipDecompress";** /\* Extracts content of gzip file as container. \*/  
**$Archive**; /\* Either container with archive or native file path.e.g. "C:\\test\\test.zip" \*/   
**$New file name**; /\* Optional; The new file name to use for container.  
Default is "data". \*/   
**$Options**) /\* Optional; The options to pass to reader.  
This is a comma-separated list of options. Option names can be prefixed with module name. \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Archive | Either container with archive or native file path. | "C:\\test\\test.zip" |  |
| New file name | The new file name to use for container.   Default is "data". |  | Optional |
| Options | The options to pass to reader.   This is a comma-separated list of options. Option names can be prefixed with module name. |  | Optional |

### Result

Returns container value or error.

### Description

Extracts content of gzip file as container.  
You may use [Archive.FileList](ArchiveFileList.md) to get a list of file names in the archive.  
  
Since a pure gz file doesn't have an archive inside like a tar.gz, this function will return the uncompressed content as new file.  
Please pass file name to have FileMaker handle the file type correctly, e.g. show picture.  
### Examples

Extract gzip file:

 Set Variable \[ $r ; Value: MBS ( "Archive.GZipDecompress"; "/Users/cs/Desktop/test.jpg.gz"; "test.jpg") \]   
Set Field \[ Contacts::Photo Container ; $r \]  
Extract text from gzip compressed text with prefixed length:

 # get some response string, gzip compressed with length before   
// Set Variable \[ $response ; Value: GzipDecompress::InputString \]   
Set Variable \[ $response ; Value: "RAAAAB+LCAAAAAAABACrZlBicGbIZ0hhSAWyrBhMGAwYDBl0gOwwhkSGHIZSqLgSEIJEg4BqSxlKkE RrGQAjtv6kRAAAAA==" \]   
\# convert base64 to Hex   
Set Variable \[ $hex ; Value: MBS ( "[Text.DecodeHexFromBase64](TextDecodeHexFromBase64.md)"; $response ) \]   
\# now we can remove the first 4 bytes with length   
Set Variable \[ $hexNum ; Value: Left($hex ; 8) \]   
Set Variable \[ $Rest ; Value: Middle ( $hex ; 9; 100000000 ) \]   
\# we can decode the length value   
Set Variable \[ $len ; Value: MBS ("[Math.DecodeNumber](MathDecodeNumber.md)"; "Integer"; 32; $hexNum ) \]   
\# and read to container value from hex   
Set Variable \[ $Cont ; Value: MBS ( "[Container.DecodeFromHex](ContainerDecodeFromHex.md)"; "FILE"; $Rest ; "test.gz" ) \]   
\# now decompress gzip   
Set Variable \[ $Decompressed ; Value: MBS ( "Archive.GZipDecompress"; $cont ; "test.txt") \]   
\# and read it as text. it is little endian UTF-16 here!   
Set Variable \[ $result ; Value: MBS ( "[Text.ReadTextFromContainer](TextReadTextFromContainer.md)"; $Decompressed ; "UTF-16LE") \]   
\# show in field   
Set Field \[ GzipDecompress::OutputString ; $result \]   
Show Custom Dialog \[ "Result" ; $result \]  
<small>  
Example result:   
{"Code" :401 ,"Value" :"" ,"Route" :"" } </small>### See also

- [Archive.ExtractFile](ArchiveExtractFile.md)
- [Archive.FileList](ArchiveFileList.md)
- [Container.DecodeFromHex](ContainerDecodeFromHex.md)
- [Math.DecodeNumber](MathDecodeNumber.md)
- [Text.DecodeHexFromBase64](TextDecodeHexFromBase64.md)
- [Text.ReadTextFromContainer](TextReadTextFromContainer.md)

### Release notes

- **Version 14.3**
    - Added Options parameter for [Archive.Content](https://www.mbsplugins.eu/ArchiveContent.shtml), [Archive.Extract](https://www.mbsplugins.eu/ArchiveExtract.shtml), [Archive.ExtractFile](https://www.mbsplugins.eu/ArchiveExtractFile.shtml), [Archive.FileList](https://www.mbsplugins.eu/ArchiveFileList.shtml) and [Archive.GZipDecompress](https://www.mbsplugins.eu/ArchiveGZipDecompress.shtml) functions.
- **Version 11.3**
    - Added [Archive.GZipDecompress](https://www.mbsplugins.eu/ArchiveGZipDecompress.shtml) function.

### Blog Entries

- [MBS FileMaker Plugin, version 14.3pr7](https://www.mbsplugins.de/archive/2024-07-05/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [New in MBS FileMaker Plugin 11.3](https://www.mbsplugins.de/archive/2021-07-27/New_in_MBS_FileMaker_Plugin_11/monkeybreadsoftware_blog_filemaker)
- [Neues MBS FileMaker Plugin 11.3](https://www.mbsplugins.de/archive/2021-07-12/Neues_MBS_FileMaker_Plugin_113/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 11.3 - More than 6500 Functions In One Plugin](https://www.mbsplugins.de/archive/2021-07-12/MBS_FileMaker_Plugin_113_-_Mor/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 11.3pr4](https://www.mbsplugins.de/archive/2021-06-22/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 18th June 2021 , last changed 4th July 2024

  
[Archive.FileList](ArchiveFileList.md) - [Archive.IsOpen](ArchiveIsOpen.md)

[HTML Version](ArchiveGZipDecompress.shtml)