lib/io_streams/s3/reader.rb in iostreams-0.19.0 vs lib/io_streams/s3/reader.rb in iostreams-0.20.0
- old
+ new
@@ -5,16 +5,17 @@
def self.open(uri, region: nil, **args, &block)
raise(ArgumentError, 'file_name must be a URI string') unless uri.is_a?(String)
IOStreams::S3.load_dependencies
+ # https://aws.amazon.com/blogs/developer/using-resources/
s3 = region.nil? ? Aws::S3::Resource.new : Aws::S3::Resource.new(region: region)
options = IOStreams::S3.parse_uri(uri)
object = s3.bucket(options[:bucket]).object(options[:key])
begin
# Since S3 download only supports a push stream, write it to a tempfile first.
- IOStreams::Path.temp_file_name('iostreams_s3') do |file_name|
+ IOStreams::File::Path.temp_file_name('iostreams_s3') do |file_name|
args[:response_target] = file_name
object.get(args)
# Return a read stream
IOStreams::File::Reader.open(file_name, &block)