lib/io_streams/paths/sftp.rb in iostreams-1.4.0 vs lib/io_streams/paths/sftp.rb in iostreams-1.5.0
- old
+ new
@@ -69,11 +69,13 @@
# IOStreams.path("sftp://test.com/path/file_name.csv", username: "jack", password: "OpenSesame").reader do |io|
# puts io.read
# end
#
# # When using the sftp executable use an identity file instead of a password to authenticate:
- # IOStreams.path("sftp://test.com/path/file_name.csv", username: "jack", ssh_options: {IdentityFile: "~/.ssh/private_key"}).reader do |io|
+ # IOStreams.path("sftp://test.com/path/file_name.csv",
+ # username: "jack",
+ # ssh_options: {IdentityFile: "~/.ssh/private_key"}).reader do |io|
# puts io.read
# end
def initialize(url, username: nil, password: nil, ssh_options: {})
uri = Utils::URI.new(url)
raise(ArgumentError, "Invalid URL. Required Format: 'sftp://<host_name>/<file_name>'") unless uri.scheme == "sftp"
@@ -120,10 +122,11 @@
# each_child('**/*.{csv,txt}') do |input, attributes|
# puts "#{input.to_s} #{attributes}"
# end
#
# Example Output:
- # sftp://sftp.example.org/a/b/c/test.txt {:type=>1, :size=>37, :owner=>"test_owner", :group=>"test_group", :permissions=>420, :atime=>1572378136, :mtime=>1572378136, :link_count=>1, :extended=>{}}
+ # sftp://sftp.example.org/a/b/c/test.txt {:type=>1, :size=>37, :owner=>"test_owner", :group=>"test_group",
+ # :permissions=>420, :atime=>1572378136, :mtime=>1572378136, :link_count=>1, :extended=>{}}
def each_child(pattern = "*", case_sensitive: true, directories: false, hidden: false)
Utils.load_soft_dependency("net-sftp", "SFTP glob capability", "net/sftp") unless defined?(Net::SFTP)
flags = ::File::FNM_EXTGLOB
flags |= ::File::FNM_CASEFOLD unless case_sensitive