/// <inheritdoc/> protected override async Task BaseDecompressAsync(Stream inputStream, Stream outputStream, CancellationToken cancellationToken = default) { using var brotliStream = new Brotli.BrotliStream(inputStream, CompressionMode.Decompress, true); await brotliStream.CopyToAsync(outputStream, DefaultBufferSize, cancellationToken).ConfigureAwait(false); await outputStream.FlushAsync(cancellationToken).ConfigureAwait(false); await brotliStream.FlushAsync(cancellationToken).ConfigureAwait(false); }
/// <inheritdoc/> protected override async Task BaseCompressAsync(Stream inputStream, Stream outputStream, CancellationToken cancellationToken = default) { using (var brotliStream = new Brotli.BrotliStream(outputStream, CompressionMode.Compress)) { brotliStream.SetQuality(Quality); brotliStream.SetWindow(Window); await inputStream.CopyToAsync(brotliStream, DefaultBufferSize, cancellationToken).ConfigureAwait(false); await inputStream.FlushAsync(cancellationToken).ConfigureAwait(false); await brotliStream.FlushAsync(cancellationToken).ConfigureAwait(false); } }