Skip to content

Commit 7255613

Browse files
committed
re-use the same buffer in extract_files
1 parent eb0f56b commit 7255613

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/extract.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,11 +611,12 @@ tarball root and must only match a single entry.
611611
"""
612612
function extract_file(predicate::Function, tarball::ArgRead, out::ArgWrite)::Vector{Header}
613613
headers = Header[]
614+
buf = Vector{UInt8}(undef, DEFAULT_BUFFER_SIZE)
614615
arg_read(tarball) do tar; arg_write(out) do io
615616
read_tarball(predicate, tar) do hdr, _
616617
if hdr.type == :file # TODO: read symlinks??
617618
push!(headers, hdr)
618-
read_data(tar, io, size=hdr.size)
619+
read_data(tar, io; size=hdr.size, buf)
619620
end
620621
end
621622
end end

0 commit comments

Comments
 (0)