Garry's Mod Wiki

util.Compress

  string util.Compress( string str )

Description

Compresses the given string using the LZMA algorithm.

Use with net.WriteData and net.ReadData for networking and util.Decompress to decompress the data.

The output of this function will have the uncompressed size of the data prepended to it as an 8-byte little-endian integer. Source

You may therefore experience issues using the output of this function outside of Garry's Mod. If you need to do this, you will need to manually strip the first 8 bytes from the compressed output, or use third-party tools such as gmod-lzma to decompress the output instead.

Arguments

1 string str
String to compress.

Returns

1 string
The compressed string, or an empty string if the input string was zero length ("").