Exemplo n.º 1
0
        /// <inheritdoc/>
        protected override async Task BaseCompressAsync(Stream inputStream, Stream outputStream, CancellationToken cancellationToken = default)
        {
            using var gZipStream = new ZstandardStream(outputStream, Level, true);
            await inputStream.CopyToAsync(gZipStream, DefaultBufferSize, cancellationToken).ConfigureAwait(false);

            await inputStream.FlushAsync(cancellationToken).ConfigureAwait(false);

            await gZipStream.FlushAsync(cancellationToken).ConfigureAwait(false);
        }
Exemplo n.º 2
0
        /// <inheritdoc/>
        protected override async Task BaseDecompressAsync(Stream inputStream, Stream outputStream, CancellationToken cancellationToken = default)
        {
            using (var gZipStream = new ZstandardStream(inputStream, CompressionMode.Decompress))
            {
                await gZipStream.CopyToAsync(outputStream, DefaultBufferSize, cancellationToken).ConfigureAwait(false);

                await outputStream.FlushAsync(cancellationToken).ConfigureAwait(false);

                await gZipStream.FlushAsync(cancellationToken).ConfigureAwait(false);
            }
        }