From 17797c76d0f7878c3c939c2e6e23bea133b0e265 Mon Sep 17 00:00:00 2001 From: KristofferC Date: Fri, 12 Mar 2021 12:42:46 +0100 Subject: [PATCH] re-use the same buffer in extract_files --- src/extract.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/extract.jl b/src/extract.jl index 59e64dc..7a04e0e 100644 --- a/src/extract.jl +++ b/src/extract.jl @@ -611,11 +611,12 @@ tarball root and must only match a single entry. """ function extract_file(predicate::Function, tarball::ArgRead, out::ArgWrite)::Vector{Header} headers = Header[] + buf = Vector{UInt8}(undef, DEFAULT_BUFFER_SIZE) arg_read(tarball) do tar; arg_write(out) do io read_tarball(predicate, tar) do hdr, _ if hdr.type == :file # TODO: read symlinks?? push!(headers, hdr) - read_data(tar, io, size=hdr.size) + read_data(tar, io; size=hdr.size, buf=buf) end end end end