How can I resume downloads in Perl?
Posted
by Neeraj
on Stack Overflow
See other posts from Stack Overflow
or by Neeraj
Published on 2010-03-21T12:00:59Z
Indexed on
2010/03/22
15:21 UTC
Read the original article
Hit count: 370
I have a project that depends upon some other binaries to be downloaded from web at install time.For this what i do is:
if ( file-present-in-src/)
# skip that file
else
# use wget to download the file
The problem with this approach is that when I interrupt a download in middle, and do invoke the script next time, the partially downloaded file is also skipped (which is not desired), also I want wget to resume the download of the partially downloaded file.
How should I go about it: Possible Solutions I could think of:
- Let the file to be downloaded to some file say download_tmp. Move to original file if successful.
- Handle SIG{'INT'} to write proper cleanup code.
But none of these could help resume the partial file download,
Any insights?
© Stack Overflow or respective owner