I have successfully downloaded tar.gz file from ftp server and have stored it in my local pc using below piece of code:
data = BytesIO()
save_file = ftp.retrbinary('RETR '+ filename, data.write, 1024)
data.seek(0)
uncompressed = gzip.decompress(data.read())
with open(filename, 'wb') as file:
file.write(uncompressed)
logging.info("success")
Now, I only want to upload the same to my azure blob storage without extracting it.
So far, I've tried this but it is letting me to do so:
```with open(filename, "rb") as f:
blob.upload_blob(f, overwrite=True)```
what I am missing here?
I tried in my environment and got below results:
To upload tar.gz file from local folder to azure blob storage you can use below code.
Code:
Console:
Portal:
Reference: Quickstart: Azure Blob Storage client library for Python - Azure Storage | Microsoft Learn