compress

Typefunction
DictionaryLCS
LibraryLiveCode Script
Syntax
the compress of <data>
compress(<data>)
Summary

Returns a gzip-compressed string.

Introduced1.0
OSmac, windows, linux, ios, android
Platformsdesktop, server, mobile
Parameters
NameTypeDescription
data

A string of binary data of any length.

Example
compress(URL "file:image.pict")
put compress(field "Outgoing") into URL "binfile:data.gz"
Values
NameTypeDescription
return

The compress function returns a string of binary data.

RelatedKeyword: URL, inverse, file, binfile, string
Function: compress, decompress
Glossary: return, binary file
Control Structure: function
Description

Use the compress function to compress data to a smaller size for transmission.

The compress function is the inverse of the decompress function.

The compressed result is typically about half to a third the size of the original data, although different results may be obtained depending on the amount of data and whether it has already been compressed.

Important: The value returned by the compress function consists of binary data and may include control characters, so displaying it on screen or trying to edit it may produce unexpected results. If you use a URL to place the returned data in a file, it's important to use the binfile URL scheme; using the file URL scheme will corrupt binary data.

For technical information about the format used by the compress function, see RFC 1952. The compress function uses the zlib compression library.

Tagstext processing