version updated
This commit is contained in:
parent
6585a7b081
commit
c3f0be6777
@ -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'
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user