compressBuffer
fn
ubyte[] compressBuffer(const(ubyte)[] input,
CompressionOptions opts = CompressionOptions.init,
string providerName = null)Compress a whole buffer in one call.
Parameters
input | Uncompressed data to compress. |
opts | Compression options; opts.format selects the provider. |
providerName | Optional 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.
fn
ubyte[] 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
fmt | The compression format to use. |
input | Uncompressed data to compress. |
providerName | Optional 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.