georgediaz88 / fun_sftp Goto Github PK
View Code? Open in Web Editor NEWMaking SFTP fun again!
Making SFTP fun again!
I used a global variable as a connection pool, but we switched to multi-threaded environment and doesn't work anymore.
Do you have an idea of how can I keep the connection alive between different HTTP request and threads?
Thanks
I created a PR for this: #8
On ruby-2.4.2 I observed that the Pathname was undefined within the SftpClient class.
I also observed that it IS defined when the tests are run. I couldn't figure out the discrepancy between the two situations. But I did observe that requiring pathname solved my issue.
I'm having a difficult issue using FunSftp, where unfortunately, our test SFTP server is a Linux server with OpenSSH, while the production server is Windows-based running CoreFTP.
Here's a snapshot of my usage:
conn = SFTPClient.new(ENV['SFTP_HOST'], ENV['SFTP_USERNAME'], nil,
:port => ENV['SFTP_PORT'], :password => ENV['SFTP_PASSWORD'],
:non_interactive => true)
conn.chdir(ENV['SFTP_DIR'])
files = conn.glob('.', filename_pattern)
files.each do |file|
conn.download!(file, local_path)
end
Against a Linux SFTP server, this works great. Against a Windows server, the code behind conn.download!
identifies the file
as a Directory, creates a directory locally in the local path with the name of the file, and then tries to download the file from within a directory. It fails that attempt.
Digging into the download!
method here, I see it makes the download recursive if has_directory?
returns true. On Windows, has_directory?
's call through Net::SFTP
incorrectly returns the filename of the file I'm trying to download instead of throwing the Net::SFTP::StatusException
like it does on Linux.
If the download!
method supported overriding the recursive
method, that would be a workaround. But, maybe there's something else going on behind the scenes.
Hello
I am having issues when I upload a file to an SFTP server, the file successfully places on the server however I am getting a "Closed Stream" error returned. Would you have any idea what causes this or how to resolve it? Thanks!
begin
conn = SFTPClient.new(details)
if conn
conn.upload!(@file_path, "#{@connection.connection_path}/#{@file_name}")
end
rescue Net::SFTP::StatusException => e
raise e
end
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.