Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 11.2   11.3   11.4   11.5   12.0   12.1   12.2   12.3   12.4   12.5    Statistic    FMM    Blog  


Extracts content of gzip file as container.

Component Version macOS Windows Linux Server iOS SDK
Archive 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Archive.GZipDecompress"; Archive { ; New file name } )   More


Parameter Description Example Flags
Archive Either container with archive or native file path. "C:\test\"
New file name The new file name to use for container.
Default is "data".


Returns container value or error.


Extracts content of gzip file as container.
You may use Archive.FileList 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.


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"; $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"; "Integer"; 32; $hexNum) ]
# and read to container value from hex
Set Variable [ $Cont ; Value: MBS( "Container.DecodeFromHex"; "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"; $Decompressed; "UTF-16LE") ]
# show in field
Set Field [ GzipDecompress::OutputString ; $result ]
Show Custom Dialog [ "Result" ; $result ]

Example result: {"Code":401,"Value":"","Route":""}

See also

Release notes

Blog Entries

Created 18th June 2021, last changed 19th June 2021

Archive.FileList - Archive.LibVersion

Feedback: Report problem or ask question.

Start Chat