e-CryptIt Engine - Compression Xojo Plugin |

# EinhugurZstandard.Compress Method (console safe)

Compresses file or steam according to how it has been set up on the class.
This method can raise the following exceptions:

- InvalidArgumentException
- IOException

Compress(
compressionLevel as Integer,
overwrite as Boolean)

#### Parameters

compressionLevel
  Compression level. (optional parameter) This can be anything from -22 to 22. Where negative values are special values to focus speed over size. Default value is 3. 20 is max safe value. 22 is absolute maximum value.
overwrite
  If set to true then destination will be replaced if it exists. If set to false and destination exists then exception will be thrown.

#### Remarks

If you are expecting big files or streams then consider putting the compressor in a thread to keep your user interface responsive, and make sure you wire up the Progress handler regardless if you use it or not to make sure the thread yields.
If source and destination are both Files then you can use the much simpler to use Task framework which will will spawn up native Thread in the background.
See the example projects to see how to use this class in a thread.

#### See Also

EinhugurZstandard Class