Buffer 16K at a time

This commit is contained in:
Jack Nagel 2015-01-05 10:45:05 -05:00
parent 3821c190f9
commit 120bd43f87
2 changed files with 2 additions and 2 deletions

View File

@ -209,7 +209,7 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy
Utils.popen_read(tool, "-f", cached_location.to_s, "-c") do |pipe|
File.open(target, "wb") do |f|
buf = ""
f.write(buf) while pipe.read(1024, buf)
f.write(buf) while pipe.read(16384, buf)
end
end
end

View File

@ -262,7 +262,7 @@ class Pathname
digest.file(self)
else
buf = ""
open("rb") { |f| digest << buf while f.read(1024, buf) }
open("rb") { |f| digest << buf while f.read(16384, buf) }
end
digest.hexdigest
end