TwentyTwenty.Storage.Amazon.AmazonStorageProvider.SaveBlobStreamAsync C# (CSharp) Method

SaveBlobStreamAsync() public method

public SaveBlobStreamAsync ( string containerName, string blobName, Stream source, BlobProperties properties = null, bool closeStream = true ) : System.Threading.Tasks.Task
containerName string
blobName string
source Stream
properties BlobProperties
closeStream bool
return System.Threading.Tasks.Task
        public async Task SaveBlobStreamAsync(string containerName, string blobName, Stream source, BlobProperties properties = null, bool closeStream = true)
        {
            if (source.Length >= 100000000)
            {
                var fileTransferUtilityRequest = CreateChunkedUpload(containerName, blobName, source, properties, closeStream);

                try
                {
                    await new TransferUtility(_s3Client).UploadAsync(fileTransferUtilityRequest);
                }
                catch (AmazonS3Exception asex)
                {
                    throw asex.ToStorageException();
                }
            }
            else
            {
                var putRequest = CreateUpload(containerName, blobName, source, properties, closeStream);

                try
                {
                    await _s3Client.PutObjectAsync(putRequest);
                }
                catch (AmazonS3Exception asex)
                {
                    throw asex.ToStorageException();
                }
            }
        }