Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
GZipFile.Compress
Compresses a file.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Compression | 4.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "GZipFile.Compress"; InputPath; OutputPath ) More
Parameters
Parameter | Description | Example |
---|---|---|
InputPath | The native path to the input file. | "C:\test.txt" |
OutputPath | The native path to the input file. | "C:\test.gz" |
Result
Returns OK or error.
Description
Compresses a file.This function uses gzip file format, so please use file extension .gz. Maximum compression is used.
As this function processes file in chunks it should work fine with huge files.
In case of an error like a full hard disk, you need to manually delete the half written output file.
This function requires a native path. Use Path.FileMakerPathToNativePath to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use FileDialog functions.
For Server be aware that server has limited permissions and may not be able to access all files on a computer.
Examples
Compress a file:
MBS( "GZipFile.Compress"; "C:\test.txt"; "C:\test.gz" )
Compress a picture:
MBS( "GZipFile.Compress"; "/Users/cs/Desktop/test.jpg"; "/Users/cs/Desktop/test.jpg.gz" )
See also
Blog Entries
This function checks for a license.
Created 18th August 2014, last changed 18th June 2021