diff --git a/czds/__init__.py b/czds/__init__.py index 266035b..e4bf1a2 100644 --- a/czds/__init__.py +++ b/czds/__init__.py @@ -5,7 +5,7 @@ from .client import CZDS -__version__ = '1.2.9' +__version__ = '1.3.0' __author__ = 'acidvegas' __email__ = 'acid.vegas@acid.vegas' __github__ = 'https://github.com/acidvegas/czds' \ No newline at end of file diff --git a/czds/client.py b/czds/client.py index 4aebf8f..dbb4d30 100644 --- a/czds/client.py +++ b/czds/client.py @@ -149,19 +149,17 @@ class CZDS: ''' logging.debug(f'Decompressing {filepath}') - output_path = filepath[:-3] # Remove .gz extension + output_path = filepath[:-3] # Remove .gz extension + chunk_size = 1024 * 1024 # 1MB chunks try: - async with aiofiles.open(filepath, 'rb') as f_in: - content = await f_in.read() - - # Use BytesIO to handle the content as a file-like object - with io.BytesIO(content) as bytes_io: - with gzip.GzipFile(fileobj=bytes_io, mode='rb') as gz: - decompressed_content = gz.read() - - async with aiofiles.open(output_path, 'wb') as f_out: - await f_out.write(decompressed_content) + with gzip.open(filepath, 'rb') as gz: + async with aiofiles.open(output_path, 'wb') as f_out: + while True: + chunk = gz.read(chunk_size) + if not chunk: + break + await f_out.write(chunk) if cleanup: os.remove(filepath) diff --git a/setup.py b/setup.py index 13b8a22..e8f8cbb 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ with open('README.md', 'r', encoding='utf-8') as fh: setup( name='czds-api', - version='1.2.9', + version='1.3.0', author='acidvegas', author_email='acid.vegas@acid.vegas', description='ICANN API for the Centralized Zones Data Service',