lib/io_streams/s3/writer.rb in iostreams-0.17.3 vs lib/io_streams/s3/writer.rb in iostreams-0.18.0
- old
+ new
@@ -65,18 +65,21 @@
# Raises [MultipartUploadError] If an object is being uploaded in
# parts, and the upload can not be completed, then the upload is
# aborted and this error is raised. The raised error has a `#errors`
# method that returns the failures that caused the upload to be
# aborted.
- def self.open(uri, region: nil, **args, &block)
+ def self.open(uri, region: nil, **args)
raise(ArgumentError, 'file_name must be a URI string') unless uri.is_a?(String)
IOStreams::S3.load_dependencies
options = IOStreams::S3.parse_uri(uri)
s3 = region.nil? ? Aws::S3::Resource.new : Aws::S3::Resource.new(region: region)
object = s3.bucket(options[:bucket]).object(options[:key])
- object.upload_stream(args, &block)
+ object.upload_stream(args) do |s3|
+ s3.binmode
+ yield(s3)
+ end
end
end
end
end