Avoid reading whole files into memory during decompression
This commit is contained in:
parent
22365f2f6d
commit
d08508f7c7
@ -107,9 +107,13 @@ class CurlDownloadStrategy < AbstractDownloadStrategy
|
|||||||
# regardless of the current working directory; the only way to
|
# regardless of the current working directory; the only way to
|
||||||
# write elsewhere is to use the stdout
|
# write elsewhere is to use the stdout
|
||||||
with_system_path do
|
with_system_path do
|
||||||
data = `gunzip -f "#{@tarball_path}" -c`
|
target = File.basename(basename_without_params, ".gz")
|
||||||
File.open(File.basename(basename_without_params, '.gz'), 'w') do |f|
|
|
||||||
f.write data
|
IO.popen("gunzip -f '#{@tarball_path}' -c") do |pipe|
|
||||||
|
File.open(target, "w") do |f|
|
||||||
|
buf = ""
|
||||||
|
f.write(buf) while pipe.read(1024, buf)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
when :gzip, :bzip2, :compress, :tar
|
when :gzip, :bzip2, :compress, :tar
|
||||||
|
Loading…
x
Reference in New Issue
Block a user