Is there a possibility to create a file directly in a tar archive?
Context: I have a method which creates content of some kind as String. I want to save this content as a file in the tar archive. Do I have to create a tmpfile or is there a possibility to create a file directly in the tar archive.
def save_files_to_tar(tarname):
archive = tarfile.open(tarname, mode='w')
for _ in range(some_number):
content = get_content()
# HERE add content to tar