lib/io_streams/paths/s3.rb in iostreams-1.0.0.beta4 vs lib/io_streams/paths/s3.rb in iostreams-1.0.0.beta5
- old
+ new
@@ -194,11 +194,11 @@
def reader(&block)
# Since S3 download only supports a push stream, write it to a tempfile first.
Utils.temp_file_name("iostreams_s3") do |file_name|
read_file(file_name)
- ::File.open(file_name, 'rb', &block)
+ ::File.open(file_name, "rb") { |io| streams.reader(io, &block) }
end
end
# Shortcut method if caller has a filename already with no other streams applied:
def read_file(file_name)
@@ -215,10 +215,10 @@
# method that returns the failures that caused the upload to be
# aborted.
def writer(&block)
# Since S3 upload only supports a pull stream, write it to a tempfile first.
Utils.temp_file_name("iostreams_s3") do |file_name|
- result = ::File.open(file_name, "wb", &block)
+ result = ::File.open(file_name, "wb") { |io| streams.writer(io, &block) }
# Upload file only once all data has been written to it
write_file(file_name)
result
end