compressBuffer

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

Compress a whole buffer in one call.

Parameters

inputUncompressed data to compress.
optsCompression options; opts.format selects the provider.
providerNameOptional provider name; if null, the highest-priority provider is used.

Returns

Compressed data as a newly allocated buffer.

Throws

CompressionError if no provider is registered for the format, the

provider does not implement compression, or compression fails. 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.