mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-14 05:25:41 +00:00
32 lines
902 B
C#
32 lines
902 B
C#
using System.IO;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using SharpCompress.IO;
|
|
|
|
namespace SharpCompress.Common.Zip;
|
|
|
|
internal sealed partial class StreamingZipFilePart
|
|
{
|
|
internal override async ValueTask<Stream?> GetCompressedStreamAsync(
|
|
CancellationToken cancellationToken = default
|
|
)
|
|
{
|
|
if (!Header.HasData)
|
|
{
|
|
return Stream.Null;
|
|
}
|
|
_decompressionStream = await CreateDecompressionStreamAsync(
|
|
await GetCryptoStreamAsync(CreateBaseStream(), cancellationToken)
|
|
.ConfigureAwait(false),
|
|
Header.CompressionMethod,
|
|
cancellationToken
|
|
)
|
|
.ConfigureAwait(false);
|
|
if (LeaveStreamOpen)
|
|
{
|
|
return SharpCompressStream.CreateNonDisposing(_decompressionStream);
|
|
}
|
|
return _decompressionStream;
|
|
}
|
|
}
|