title: Add file to tar archive without saving it first
body: <p>Is there a possibility to create a file directly in a tar archive?<br>
  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.   </p>
  
  <pre><code>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
  </code></pre>