decompressAsync

suspend fun decompressAsync(buffer: ReadBuffer, algorithm: CompressionAlgorithm = CompressionAlgorithm.Gzip, factory: BufferFactory = BufferFactory.Default, expectedOutputSize: Int = 0): PlatformBuffer

Decompresses 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 SuspendingStreamingDecompressor directly.

Return

The decompressed data as a single buffer (position=0, limit=decompressed size)

Parameters

buffer

The compressed data (reads from position to limit). Position is advanced.

algorithm

The compression algorithm to use

factory

The buffer factory for the output buffer

expectedOutputSize

Hint for pre-allocating the output buffer. If the actual decompressed size exceeds this, the buffer grows automatically. Use 0 (default) if unknown. Providing a good estimate reduces memory allocations.