public static async Task <PutObjectResponse> PutObjectDataAsync(this IS3ObjectClient client, string bucketName, string resource, byte[] data, Action <PutObjectRequest> config = null, CancellationToken token = default) { Validator.RequireNotNull(client); Validator.RequireNotNull(bucketName); Validator.RequireNotNull(resource); using (MemoryStream ms = new MemoryStream(data)) return(await client.PutObjectAsync(bucketName, resource, ms, config, token).ConfigureAwait(false)); }
public static async Task <PutObjectResponse> PutObjectFileAsync(this IS3ObjectClient client, string bucketName, string resource, string file, Action <PutObjectRequest> config = null, CancellationToken token = default) { Validator.RequireNotNull(client); Validator.RequireNotNull(bucketName); Validator.RequireNotNull(resource); if (!File.Exists(file)) { throw new FileNotFoundException("The file does not exist.", file); } using (FileStream fs = File.OpenRead(file)) return(await client.PutObjectAsync(bucketName, resource, fs, config, token).ConfigureAwait(false)); }
public Task <PutObjectResponse> PutObjectAsync(string bucketName, string resource, Stream data, Action <PutObjectRequest> config = null, CancellationToken token = default) { return(_objectClient.PutObjectAsync(bucketName, resource, data, config, token)); }