Closed Changaco closed 2 years ago
The standard tell
method can be used to estimate how much of an archive has been processed. Here's an example of a progress bar using tqdm
:
with tqdm(total=os.stat(archive_path).st_size, unit='bytes') as pbar, \
open(archive_path, 'rb') as file, \
libarchive.stream_reader(file) as archive:
for entry in archive:
...
pbar.update(file.tell() - pbar.n)
See https://github.com/Legilibre/legi.py/pull/83 for context.