Skip to content

Instantly share code, notes, and snippets.

@jhidding
jhidding / archive.py
Created February 3, 2017 10:01
An archive class, allowing easy access to files in a TAR
class Archive(object):
"""Easy interface to `tarfile`.
We use buffered `tar` files to communicate with Docker
containers. This class provides an easy way to create
`tar` buffers on the fly, or read from them.
Methods in this class can be chained JS style."""
def __init__(self, mode, data=None):
self.file = io.BytesIO(data)