Method CopyToSyncAsAsync
CopyToSyncAsAsync(Stream, int, CancellationToken)
For known destination classes that are in-memory, we can optimize the copy operation by copying synchronously instead of asynchronously.
protected Task CopyToSyncAsAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
Parameters
destinationStreamThe destination stream to copy the contents of this stream to.
bufferSizeintThe size of the buffer to use for copying the stream contents.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.