Implement Remote::FS#file_read

This commit is contained in:
Thibault Jouan
2014-01-23 16:37:02 +00:00
parent 39b3796aa0
commit 05331d334d
2 changed files with 37 additions and 0 deletions

View File

@@ -30,6 +30,12 @@ module Producer
sftp.mkdir! path
end
def file_read(path)
sftp.file.open(path) { |f| content = f.read }
rescue Net::SFTP::StatusException
nil
end
def file_write(path, content)
sftp.file.open path, 'w' do |f|
f.write content