compress Async
suspend fun compressAsync(buffer: ReadBuffer, algorithm: CompressionAlgorithm = CompressionAlgorithm.Gzip, level: CompressionLevel = CompressionLevel.Default, zone: AllocationZone = AllocationZone.Direct): PlatformBuffer
Compresses data using the specified algorithm. Works on all platforms.
This is a convenience function that handles the streaming API internally. For large data or when you need to process chunks incrementally, use SuspendingStreamingCompressor directly.
Return
The compressed data as a single buffer (position=0, limit=compressed size)
Parameters
buffer
The data to compress (reads from position to limit). Fully consumed after call.
algorithm
The compression algorithm to use
level
The compression level
zone
The allocation zone for the output buffer