Extract a Zipped Object
The following SDK method will allow you to extract a zip file inside Stratus, and every individual content present in the zip file will be considered as individual object and uploaded to Stratus in the same bucket. This entire process will happen asynchronously. The Bucket reference used in the below code snippet is the component instance.
Parameters Used
Parameter Name | Data Type | Definition |
---|---|---|
key | String | A Mandatory parameter. Will be the name of the zip file, you need to extract |
destination | String | A Mandatory parameter. Will contain the complete path information of the destination, where the extracted objects will be stored in the bucket. |
copyunzip_res = bucket.unzip_object("sam/out/sample.zip","output/") print(unzip_res)
Example Response
copy{ "key": "sam/out/sample.zip", "destination": "output/", "task_id": "6963000000272049", "message": "Zip extract scheduled" }
Get Zip Extraction Status
The zip extraction process occurs asynchronously, and the time it takes to complete the extraction process is highly contingent on the size of the zip file.
Using the task_id parameter, in the following SDK method, we can determine the status of the extraction. The task_id is returned in the response of unzip_object() method.
copyres = bucket.get_unzip_status("sam/out/sample.zip", 'task_id') print(res)
Example Response
copy{ "task_id": "6963000000272049", "status": "SUCCESS" }
Last Updated 2025-05-30 16:54:59 +0530 +0530
Yes
No
Send your feedback to us