lib/io_streams/paths/sftp.rb in iostreams-1.0.0.beta4 vs lib/io_streams/paths/sftp.rb in iostreams-1.0.0.beta5
- old
+ new
@@ -95,11 +95,11 @@
# Note:
# - raises Net::SFTP::StatusException when the file could not be read.
def reader(&block)
IOStreams.temp_file("iostreams-sftp-reader") do |temp_file|
sftp_download(path, temp_file.to_s)
- temp_file.reader(&block)
+ ::File.open(temp_file.to_s, "rb") { |io| streams.reader(io, &block) }
end
end
# Write to a file on a remote sftp server.
#
@@ -109,10 +109,10 @@
# writer do |output|
# output.write('Hello World')
# end
def writer(&block)
IOStreams.temp_file("iostreams-sftp-writer") do |temp_file|
- temp_file.writer(&block)
+ ::File.open(temp_file.to_s, "wb") { |io| streams.writer(io, &block) }
sftp_upload(temp_file.to_s, path)
temp_file.size
end
end