Ruby Net/SFTP throttle speed

401 Views Asked by At

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.

1

There are 1 best solutions below

1
On BEST ANSWER

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?