This document describes how to use SCF to automatically decompress files in COS. COS is used to store uploaded .zip files and decompressed files, and SCF automatically decompresses .zip files uploaded to COS.
The main parameter information is as follows. Keep the remaining parameters as default:
mubucketas an example.
On the bucket management page, select Function Service on the left.
Click Add Function in "ZIP File Decompression Function". In the "Create ZIP File Decompression Function" window that pops up,
configure the following information.
POST ObjectAPI. When Create using Put method is selected as the event, only packages uploaded through the
PUT ObjectAPI will trigger decompression.
If your file is uploaded to the bucket by means of simple upload, multipart upload, or cross-region replication, we recommend you select the File upload event.
If there is a containment relationship between the configured destination file prefix and the trigger condition, loop triggering may be caused, which should be avoided. For example, if the destination prefix is
prefixand the trigger condition is
pre, decompression will be triggered repeatedly when a
prefpackage is uploaded.
After adding the configuration, select Confirm, and you will see that the function has been added.
You can select View Log to view the history of decompression. If an error occurs during decompression, you can quickly enter the SCF Console to view the error details by selecting View Log. If you need to delete a file decompression rule no longer used, select Delete to delete the relevant configuration.
On the bucket management page, select File List on the left.
On the file list page, click Upload Files and select a .zip file for upload.
Refresh the current bucket to check whether files are generated after decompression.
Switch to Function Service to view the log or enter the SCF Console to view the execution result, and you will see the printed log information in Execution Log.
Contact our sales team or business advisors to help your business.
Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.
Was this page helpful?