public static async Task <string> GetObjectStringAsync(this IObjectClient client, string bucketName, string objectKey, Encoding encoding = null, Action <GetObjectRequest> config = null, CancellationToken token = default) { ContentReader content = await GetObjectContentAsync(client, bucketName, objectKey, config, token).ConfigureAwait(false); if (content != null) { return(await content.AsStringAsync(encoding).ConfigureAwait(false)); } return(null); }
public static async Task <string> GetObjectStringAsync(this IS3ObjectClient client, string bucketName, string resource, Encoding encoding = null, Action <GetObjectRequest> config = null, CancellationToken token = default) { Validator.RequireNotNull(client); Validator.RequireNotNull(bucketName); Validator.RequireNotNull(resource); ContentReader content = await GetObjectContentAsync(client, bucketName, resource, config, token).ConfigureAwait(false); if (content != null) { return(await content.AsStringAsync(encoding).ConfigureAwait(false)); } return(null); }