CodecZlib.jl icon indicating copy to clipboard operation
CodecZlib.jl copied to clipboard

position (for an approximate progress bar)

Open tpapp opened this issue 7 years ago • 0 comments

I am reading and processing a large gzip-compressed file and want to show some progress information, preferably with ProgressMeter.jl, which has the following idiom:

seekend(io)
fileSize = position(io)
seekstart(io)
p = Progress(fileSize, 1)   # minimum update interval: 1 second
while !eof(io)
    line = readline(io)
    # Here's where you do all the hard, slow work
    
    update!(p, position(io))
end

In the example above, io would come from a GzipDecompressorStream. But

julia> position(io)
ERROR: MethodError: no method matching position(::TranscodingStreams.TranscodingStream{CodecZlib.GzipDecompressor,IOStream})

I understand that the position may not be clearly defined because of buffering, but since seekend and seekstart are supported, is it possible to get eg the position of the original stream?

tpapp avatar Jul 13 '18 14:07 tpapp