Mehedi

load File
mail@pastecode.io avatar
unknown
csharp
2 years ago
653 B
2
Indexable
Never
 public async Task<string> LoadFileAsync(string? filename, string? bucketName = null, string? bucketFolder = null)
        {
			if (bucketName is null)
				bucketName = _bucketCredentials.BucketName;

			if (bucketFolder is null)
				bucketFolder = _bucketCredentials.BucketFolderPath;

			string pathDivider = bucketFolder is null ? string.Empty : "/";
			var request = new GetPreSignedUrlRequest() {
				BucketName = bucketName,
				Key = $"{bucketFolder}{pathDivider}{filename}",
				Expires = DateTime.UtcNow.AddMinutes(1)
			};
			var result = _s3Client.GetPreSignedURL(request);
			Console.WriteLine(result);
			return result;
		}