Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

set the download speed with LWP - Perl

Tags:

wget

perl

lwp

I am developing an application which download files from internet; the files are mainly in ftp servers, I am using LWP::Simple and the getstore function to retrieve the files. But I would like to limit the speed of download, like in wget ...

have you seen something similar to the --limit-rate from wget implemented within LWP or LWP::Simple??

Thanks

like image 948
Juan Avatar asked Dec 07 '25 03:12

Juan


2 Answers

If your main concerns are FTP servers, maybe look at Net::FTP::Throttle. You can set maximum rate in constructor.

like image 89
bvr Avatar answered Dec 08 '25 18:12

bvr


There is no such option.

If you use a callback to grab the response body, you could intentionally slow down the callback (using sleep()) when necessary to provide the desired rate.

Of course, you could also avoid LWP entirely. For example, you could and shell out to call wget, curl or whatever. You could also use another module such as WWW::Curl.

Update: Added last paragraph.

like image 29
ikegami Avatar answered Dec 08 '25 17:12

ikegami



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!