On iOS 13 and macOS 10.15 Apple ships some nice functions to compress and decompress in one line of code.
However they only support DEFLATE (RFC 1951) and I have data compressed with ZLIB (RFC 1950).
I have experimentally found that if I remove the first 2 bytes then decompress works:
let output = try NSData(data: input[2...]).decompressed(using: .zlib)
Is this a reliable method?
For compression I've tried adding a 2 byte header:
let output = try Data([0x78, 0x9c]) + input.compressed(using: .zlib)
This works in a few simple cases but definitely fails in others. Is there any way to make this work?