I finally re-wrote a StreamingResponse
class which takes the file paths to be read and generate the .tar.gz file while sending chunks to the network.
This way, I had to read deeply the tarfile.TarFile
and tarfile._Stream
and rewrite it.
The whole code is available at this gist: https://gist.github.com/etienne-monier/a608f7174ea808e3f8ac4e714156f3b8