If you need to download files by chunks, you could send a block to the download method.
However, if for some reason the execution of this block failed, there was no way to resume the processing from the last successfully processed chunk.
To take advantage of those previous chunks, it was necessary to re-implement the reading of files by chunks, using the download_chunk method, keeping a record of the execution point and updating offsets (something like a local pagination of chunks)
With the download_with_index method we will receive the chunk and (optionally) the current index in each block.
In case of failures, you only need to restart the execution with the index
a_tb_file.download_with_index(last_successfully_processed_chunk_index) do |chunk, index|
last_successfully_processed_chunk_index = index