This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mgorny
Recipients mgorny
Date 2018-11-13.08:27:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1542097676.97.0.788709270274.issue35227@psf.upfronthosting.co.za>
In-reply-to
Content
Currently, the tarfile module only supports adding files if their size is known prior to adding.  However, I think it'd be helpful to be able to store large dynamically generated streams straight into the (uncompressed) .tar file without being able to precalculate the final size and without having to use a temporary file.

I'm not really sure how the API should look like (i.e. whether it should be a new method or extension of addfile()) but the mechanism would be rather simple -- write TarInfo with size of 0, write data until end of stream, write padding appropriately to written data, seek back and update TarInfo.

Of course, the use of this API would have to be restricted to cases when underlying file supports seeking back and random writes, i.e. not stream, not compressed.
History
Date User Action Args
2018-11-13 08:27:57mgornysetrecipients: + mgorny
2018-11-13 08:27:56mgornysetmessageid: <1542097676.97.0.788709270274.issue35227@psf.upfronthosting.co.za>
2018-11-13 08:27:56mgornylinkissue35227 messages
2018-11-13 08:27:56mgornycreate