compressBuffer

fnubyte[] compressBuffer(const(ubyte)[] input, CompressionOptions opts = CompressionOptions.init, string providerName = null)

Convenience: compress a whole buffer using GC allocations. Not suitable for untrusted gigantic inputs.

fnubyte[] compressBuffer(CompressionFormat fmt, const(ubyte)[] input, string providerName = null)

Convenience: compress a whole buffer with just a format specification.

This is a simpler overload when you only need to specify the compression format without additional options like level or strategy.

Parameters

fmtThe compression format to use.
inputUncompressed data to compress.
providerNameOptional provider name; if null, the highest-priority provider is used.

Returns

Compressed data as a new buffer.

Throws

CompressionError if compression fails or no provider is registered for the format.