mw99 / DataCompression

Swift libcompression wrapper as an extension for the Data type (GZIP, ZLIB, LZFSE, LZMA, LZ4, deflate, RFC-1950, RFC-1951, RFC-1952)
Apache License 2.0
287 stars 57 forks source link

Can you make custom compression levels #29

Open Mikebanana opened 2 years ago

Mikebanana commented 2 years ago

Always compressed level 5 is too rigid

mw99 commented 2 years ago

Hi! Unfortunately Apples Compression Framework does not allow special compression flags to be passed to the underlaying algorithm. I thought, Apple would add it one day, and then I would of course too, but that never happened.

Your only option is to use zlib directly if you want to change the compression level. If you are willing to go down that road, may I recommend taking a look at my code here, it shows how to load a function pointer from the zlib dynamically at runtime.

Also I'm pretty sure there is a clean Swift wrapper around libz out there as well.