Open incomplete download in append mode

Open the incomplete download in append mode instead of write mode.
Opening in write mode truncates the existing file, so curl keeps
restarting downloads instead of resuming the incomplete downloads.
This commit is contained in:
buo 2016-10-25 16:46:59 +09:00
parent 79e8cdd3ed
commit 6a406763f3

View File

@ -105,7 +105,7 @@ module Hbc
else
had_incomplete_download = temporary_path.exist?
begin
File.open(temporary_path, "w+") do |f|
File.open(temporary_path, "a+") do |f|
f.flock(File::LOCK_EX)
_fetch
f.flock(File::LOCK_UN)