Question

Is there a way to throttle the connection of a transfer with the ruby Net/SFTP library? I would like to leverage this to download some backups on a nightly basis, but don't want to eat up all of the server's bandwidth while doing so.

Was it helpful?

Solution

Consider this sample from the Net::SFTP documentation:

# open and read from a pseudo-IO for a remote file
sftp.file.open("/path/to/remote", "r") do |f|
  puts f.gets
end

What would happen if you put a sleep inside that block?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top