0

I am working on creating a tool that allows to sftp from location to another using https://www.npmjs.com/package/ssh2-sftp-client library. The issue that I am running into and trying to figure out how I can throttle the download speed either by a percentage or by a fixed amount like 5 Mbps to avoid maxing out the network link. Has anyone experienced this or has some pointers or ideas on how I can accomplish throttling of the sftp session?

I have look at the ssh2 library https://www.npmjs.com/package/ssh2 but it dosent look like it has the ability for a way to throttle the download. I also tried passing in a stream like the documentation on that library suggests and like some people have suggested but it always returns stream is undefined.

Joe
  • 1
  • 1
  • [`sftp.get(remoteFilePath, [options])`](https://www.npmjs.com/package/ssh2-sftp-client#get) returns a `ReadableStream`. If the stream properly implements backpressure you can simply read from the stream at the desired rate or even pause the stream and resume it at a later time. – Jake Holzinger Jun 27 '19 at 18:02
  • Possible duplicate of [NodeJS - Serve file with throttled speed](https://stackoverflow.com/questions/38980951/nodejs-serve-file-with-throttled-speed) – Kate Orlova Jun 27 '19 at 18:05

0 Answers0