Minor changes

This commit is contained in:
Adam Hathcock
2021-02-14 12:55:05 +00:00
parent 15209178ce
commit 7e9fb645cb
2 changed files with 3 additions and 2 deletions

View File

@@ -20,7 +20,8 @@ namespace SharpCompress.Writers
{
throw new ArgumentException("Source does not exist: " + source.FullName);
}
using (var stream = source.OpenRead())
await using (var stream = source.OpenRead())
{
await writer.WriteAsync(entryPath, stream, source.LastWriteTime, cancellationToken);
}

View File

@@ -107,7 +107,7 @@ namespace SharpCompress.Writers.Zip
public async ValueTask WriteAsync(string entryPath, Stream source, ZipWriterEntryOptions zipWriterEntryOptions, CancellationToken cancellationToken = default)
{
await using Stream output = await WriteToStreamAsync(entryPath, zipWriterEntryOptions, cancellationToken);
await source.TransferToAsync(output, cancellationToken);
await source.CopyToAsync(output, cancellationToken);
}
public async ValueTask<Stream> WriteToStreamAsync(string entryPath, ZipWriterEntryOptions options, CancellationToken cancellationToken = default)