Esempio n. 1
0
        public async Task UploadBlobAsync(IUploadBlobRequest uploadBlobRequest, CancellationToken cancellationToken)
        {
            var request = (UploadBlobRequest)uploadBlobRequest;

            Debug.WriteLine($"S3Blobs.UploadBlobAsync() {request.FileFingerprint.FullFilePath} ({request.FileFingerprint.Fingerprint.Key().Substring(0, 12)})");

            var putObjectRequest = request.Request;

            var bufferSize = (int)Math.Min(81920, Math.Max(1024, request.FileFingerprint.Fingerprint.Size));

            using (var s = new FileStream(uploadBlobRequest.FileFingerprint.FullFilePath,
                                          FileMode.Open, FileSystemRights.Read, FileShare.Read,
                                          bufferSize,
                                          FileOptions.Asynchronous | FileOptions.SequentialScan))
            {
                putObjectRequest.InputStream = s;

                await PutAsync(request, cancellationToken).ConfigureAwait(false);
            }
        }
Esempio n. 2
0
        public async Task UploadBlobAsync(IUploadBlobRequest uploadBlobRequest, CancellationToken cancellationToken)
        {
            var request = (UploadBlobRequest)uploadBlobRequest;

            Debug.WriteLine($"S3Blobs.UploadBlobAsync() {request.FileFingerprint.FullFilePath} ({request.FileFingerprint.Fingerprint.Key().Substring(0, 12)})");

            var putObjectRequest = request.Request;

            var bufferSize = (int)Math.Min(81920, Math.Max(1024, request.FileFingerprint.Fingerprint.Size));

            using (var s = new FileStream(uploadBlobRequest.FileFingerprint.FullFilePath,
                FileMode.Open, FileSystemRights.Read, FileShare.Read,
                bufferSize,
                FileOptions.Asynchronous | FileOptions.SequentialScan))
            {
                putObjectRequest.InputStream = s;

                await PutAsync(request, cancellationToken).ConfigureAwait(false);
            }
        }