10 lines
236 B
Python
10 lines
236 B
Python
import io
|
|
import tarfile
|
|
|
|
def raw_to_tar(raw_object):
|
|
tarball = io.BytesIO(raw_object)
|
|
return tarfile.open(fileobj=tarball, mode='r:gz')
|
|
|
|
def extract_file_from_tar(tar, file_name):
|
|
return tar.extractfile(tar.getmember(file_name))
|