Closed
Description
A stream-returning method is required to access the file from memory without writing it to disk.
DownloadAttachmentAsync like
public async Task<Stream> DownloadAttachmentAsStreamAsync(CouchAttachment attachment, CancellationToken cancellationToken = default)
{
Check.NotNull(attachment, nameof(attachment));
if (attachment.Uri == null)
{
throw new InvalidOperationException("The attachment is not uploaded yet.");
}
return await NewRequest()
.AppendPathSegment(attachment.DocumentId)
.AppendPathSegment(Uri.EscapeUriString(attachment.Name))
.WithHeader("If-Match", attachment.DocumentRev)
.GetStreamAsync(cancellationToken)
.ConfigureAwait(false);
}