Skip to content

Instantly share code, notes, and snippets.

View mygithub23's full-sized avatar

Ali Alaoui mygithub23

  • Raytheon
  • Ashburn
  • 22:55 (UTC -04:00)
View GitHub Profile
@mygithub23
mygithub23 / streaming-tar.py
Created December 29, 2024 06:07 — forked from allista/streaming-tar.py
Sample code to build a tar chunk-by-chunk and stream it out all at once.
# Building a tar file chunk-by-chunk.
#
# This is a quick bit of sample code for streaming data to a tar file,
# building it piece-by-piece. The tarfile is built on-the-fly and streamed
# back out. This is useful for web applications that need to dynamically
# build a tar file without swamping the server.
import tarfile
from io import BytesIO