Skip to content

Commit

Permalink
re-use the same buffer in extract_files
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Mar 12, 2021
1 parent eb0f56b commit 7255613
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/extract.jl
Expand Up @@ -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)
end
end
end end
Expand Down

0 comments on commit 7255613

Please sign in to comment.