mirror of
https://github.com/robmcmullen/atrcopy.git
synced 2024-06-09 00:29:28 +00:00
19 lines
422 B
Python
19 lines
422 B
Python
import gzip
|
|
import io
|
|
|
|
import numpy as np
|
|
|
|
from . import errors
|
|
from .utils import to_numpy
|
|
|
|
|
|
class GZipContainer(DiskImageContainer):
|
|
def unpack_bytes(self, byte_data):
|
|
try:
|
|
buf = io.BytesIO(byte_data)
|
|
with gzip.GzipFile(mode='rb', fileobj=buf) as f:
|
|
unpacked = f.read()
|
|
except OSError as e:
|
|
raise errors.InvalidContainer(e)
|
|
return unpacked
|