Skip to content

Instantly share code, notes, and snippets.

View allista's full-sized avatar

Allis Tauri allista

View GitHub Profile
@allista
allista / streaming-tar.py
Last active December 29, 2024 06:07 — forked from chipx86/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